From b53981c439d9ab0d76fe8ed0c1c96f8533541122 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 11 Mar 2016 12:41:43 +1000 Subject: [PATCH] Add a few client error messages Signed-off-by: Peter Hutterer --- src/libratbag.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libratbag.c b/src/libratbag.c index cceb61be..8baa9e9d 100644 --- a/src/libratbag.c +++ b/src/libratbag.c @@ -643,8 +643,10 @@ ratbag_device_get_profile(struct ratbag_device *device, unsigned int index) { struct ratbag_profile *profile; - if (index >= ratbag_device_get_num_profiles(device)) + if (index >= ratbag_device_get_num_profiles(device)) { + log_bug_client(device->ratbag, "Requested invalid profile %d\n", index); return NULL; + } list_for_each(profile, &device->profiles, link) { if (profile->index == index) @@ -730,8 +732,11 @@ ratbag_profile_get_resolution(struct ratbag_profile *profile, unsigned int idx) struct ratbag_resolution *res; unsigned max = ratbag_profile_get_num_resolutions(profile); - if (idx >= max) + if (idx >= max) { + log_bug_client(profile->device->ratbag, + "Requested invalid resolution %d\n", idx); return NULL; + } res = &profile->resolution.modes[idx]; @@ -875,8 +880,10 @@ ratbag_profile_get_button(struct ratbag_profile *profile, struct ratbag_device *device = profile->device; struct ratbag_button *button; - if (index >= ratbag_device_get_num_buttons(device)) + if (index >= ratbag_device_get_num_buttons(device)) { + log_bug_client(device->ratbag, "Requested invalid button %d\n", index); return NULL; + } list_for_each(button, &profile->buttons, link) { if (button->index == index)