1
0
forked from drath/libratbag

prevent a segfault in sanity_check_device

If a device has missing profiles, profile will be null and we will
have a segfault.
Better say that the device failed the sanity check.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Benjamin Tissoires
2015-09-04 11:50:24 -04:00
parent 28a94d0974
commit 97bfc86165

View File

@@ -324,6 +324,9 @@ ratbag_sanity_check_device(struct ratbag_device *device)
nprofiles = ratbag_device_get_num_profiles(device);
for (i = 0; i < nprofiles; i++) {
profile = ratbag_device_get_profile_by_index(device, i);
if (!profile)
goto out;
/* Allow max 1 default profile */
if (profile->is_default) {
if (has_default) {