diff --git a/src/driver-hidpp10.c b/src/driver-hidpp10.c index 42c632c5..992f8487 100644 --- a/src/driver-hidpp10.c +++ b/src/driver-hidpp10.c @@ -453,8 +453,8 @@ hidpp10drv_read_profile(struct ratbag_profile *profile) /* FIXME: this relies on libratbag using the * same steps that we support */ ratbag_resolution_set_dpi_list_from_range(res, min, max); - } else { - for (int i = 0; i < hidpp10->dpi_count; i++) + } else if (hidpp10->dpi_count > 0) { + for (uint8_t i = 0; i < hidpp10->dpi_count; i++) dpis[i] = hidpp10->dpi_table[i].dpi; ratbag_resolution_set_dpi_list(res, dpis, hidpp10->dpi_count);