Allow for zero number of dpi values to be set

At least in the DBus API we can't just say "doesn't exist", so let's allow for
a zero-sized list.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-10-16 17:55:01 +10:00
committed by Benjamin Tissoires
parent 3e0c803a37
commit 74a5551a8d
2 changed files with 6 additions and 0 deletions

View File

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