diff --git a/doc/dbus.rst b/doc/dbus.rst index f05fc6ae..be89ef62 100644 --- a/doc/dbus.rst +++ b/doc/dbus.rst @@ -278,6 +278,9 @@ org.freedesktop.ratbag1.Resolution the :js:attr:`Resolution` property. This list is always sorted ascending, the lowest resolution is the first item in the list. + This list may be empty if the device does not support reading and/or + writing to resolutions. + .. js:attribute:: ReportRate :type: u diff --git a/src/libratbag.c b/src/libratbag.c index 0db50e31..b3e39661 100644 --- a/src/libratbag.c +++ b/src/libratbag.c @@ -1131,6 +1131,9 @@ ratbag_resolution_get_dpi_list(struct ratbag_resolution *resolution, assert(nres > 0); + if (resolution->ndpis == 0) + return 0; + memcpy(resolutions, resolution->dpis, sizeof(unsigned int) * min(nres, resolution->ndpis));