libratbag-data: set fallback value in the same place as the proper value

This commit is contained in:
Yaroslav Chvanov
2023-03-07 04:38:53 +03:00
parent fd6e693e88
commit 17d869d5bf

View File

@@ -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);
}