Fix a crash when initializing an illuminance sensor on Linux (#17408)
This commit is contained in:
parent
47d888364d
commit
0bb0077358
|
@ -201,6 +201,10 @@ linux_illuminance_sensor_t *linux_open_illuminance_sensor(unsigned rate)
|
||||||
if (!sensor)
|
if (!sensor)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
device = retro_opendir(IIO_DEVICES_DIR);
|
||||||
|
if (!device)
|
||||||
|
goto error;
|
||||||
|
|
||||||
sensor->millilux = 0;
|
sensor->millilux = 0;
|
||||||
sensor->poll_rate = rate ? rate : DEFAULT_POLL_RATE;
|
sensor->poll_rate = rate ? rate : DEFAULT_POLL_RATE;
|
||||||
sensor->thread = NULL; /* We'll spawn a thread later, once we find a sensor */
|
sensor->thread = NULL; /* We'll spawn a thread later, once we find a sensor */
|
||||||
|
@ -243,7 +247,7 @@ linux_illuminance_sensor_t *linux_open_illuminance_sensor(unsigned rate)
|
||||||
}
|
}
|
||||||
|
|
||||||
error:
|
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);
|
retro_closedir(device);
|
||||||
|
|
||||||
free(sensor);
|
free(sensor);
|
||||||
|
|
Loading…
Reference in New Issue