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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user