From 17d869d5bf54921643b0ff1f2757ca18bc550efb Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Tue, 7 Mar 2023 04:38:53 +0300 Subject: [PATCH] libratbag-data: set fallback value in the same place as the proper value --- src/libratbag-data.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libratbag-data.c b/src/libratbag-data.c index 6584f894..79b25965 100644 --- a/src/libratbag-data.c +++ b/src/libratbag-data.c @@ -248,8 +248,6 @@ init_data_sinowealth(struct ratbag *ratbag, struct sinowealth_device_data *device = zalloc(sizeof(struct sinowealth_device_data)); - device->profile_count = -1; - device->button_count = g_key_file_get_integer(keyfile, device_group, "ButtonCount", &error); g_clear_error(&error); @@ -276,8 +274,11 @@ init_data_sinowealth(struct ratbag *ratbag, g_clear_error(&error); rc = g_key_file_get_integer(keyfile, device_group, "ProfileCount", &error); - if (rc != 0 && !error) + if (rc != 0 && !error) { device->profile_count = rc; + } else { + device->profile_count = -1; + } list_insert(&data->sinowealth.supported_devices, &device->link); }