ecore-drm2: Fix potential invalid access to output current_mode
authorChris Michael <cpmichael@osg.samsung.com>
Wed, 11 May 2016 13:43:53 +0000 (09:43 -0400)
committerChris Michael <cpmichael@osg.samsung.com>
Fri, 27 May 2016 15:57:53 +0000 (11:57 -0400)
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
src/lib/ecore_drm2/ecore_drm2_outputs.c

index 81e0018..7596164 100644 (file)
@@ -90,11 +90,21 @@ _output_event_send(Ecore_Drm2_Output *output)
 
    ev->x = output->x;
    ev->y = output->y;
-   ev->w = output->current_mode->width;
-   ev->h = output->current_mode->height;
+   if (output->current_mode)
+     {
+        ev->w = output->current_mode->width;
+        ev->h = output->current_mode->height;
+        ev->refresh = output->current_mode->refresh;
+     }
+   else
+     {
+        ev->w = output->ocrtc->width;
+        ev->h = output->ocrtc->height;
+        ev->refresh = 0;
+     }
+
    ev->phys_width = output->pw;
    ev->phys_height = output->ph;
-   ev->refresh = output->current_mode->refresh;
 
    ev->scale = output->scale;
    ev->subpixel = output->subpixel;