gdk_x11_display_get_monitor: fix monitor number test logic

When asked for a nonexistent (positive) monitor number,
gdk_x11_display_get_monitor would (at best) return an uninitialized pointer,
instead of returning NULL.
This commit is contained in:
Sébastien Villemot 2018-04-09 15:36:36 +02:00
parent bb8f6f87ae
commit bb8debe925

View File

@ -2951,7 +2951,7 @@ gdk_x11_display_get_monitor (GdkDisplay *display,
{
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
if (0 <= monitor_num || monitor_num < x11_display->monitors->len)
if (0 <= monitor_num && monitor_num < x11_display->monitors->len)
return (GdkMonitor *)x11_display->monitors->pdata[monitor_num];
return NULL;