avoid null deref
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 14 Jan 2011 02:57:07 +0000 (02:57 +0000)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 14 Jan 2011 02:57:07 +0000 (02:57 +0000)
SVN revision: 56084

legacy/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c

index bd56228..ad1192c 100644 (file)
@@ -1788,7 +1788,7 @@ ecore_x_randr_move_crtcs(Ecore_X_Window root,
            goto _ecore_x_randr_move_crtcs_fail_free_crtc_info;
 
         //actually move all the crtcs, keep their rotation and mode.
-        for (i = 0; i < ncrtc; i++)
+        for (i = 0; (i < ncrtc) && crtc_info[i]; i++)
           {
              if (!ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL,
                                                   Ecore_X_Randr_Unset,
@@ -1805,7 +1805,7 @@ ecore_x_randr_move_crtcs(Ecore_X_Window root,
           {
              //something went wrong, let's try to move the already moved crtcs
              //back.
-             while (i-- >= 0)
+             while (((i--) >= 0))
                 ecore_x_randr_crtc_settings_set(root,
                                                 crtcs[i],
                                                 NULL,