Skip to content

Commit

Permalink
Fix a crash when initializing an illuminance sensor on Linux (#17408)
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTG authored Jan 13, 2025
1 parent 47d8883 commit 0bb0077
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion input/common/linux_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ linux_illuminance_sensor_t *linux_open_illuminance_sensor(unsigned rate)
if (!sensor)
goto error;

device = retro_opendir(IIO_DEVICES_DIR);
if (!device)
goto error;

sensor->millilux = 0;
sensor->poll_rate = rate ? rate : DEFAULT_POLL_RATE;
sensor->thread = NULL; /* We'll spawn a thread later, once we find a sensor */
Expand Down Expand Up @@ -243,7 +247,7 @@ linux_illuminance_sensor_t *linux_open_illuminance_sensor(unsigned rate)
}

error:
RARCH_ERR("Failed to find an illuminance sensor\n");
RARCH_ERR("Failed to find an illuminance sensor in " IIO_DEVICES_DIR "\n");
retro_closedir(device);

free(sensor);
Expand Down

0 comments on commit 0bb0077

Please sign in to comment.