elementary/elm_win: Check argument for NULL before we pass it to strncmp
authorStefan Schmidt <stefan@datenfreihafen.org>
Thu, 14 Jun 2012 15:01:37 +0000 (15:01 +0000)
committerStefan Schmidt <stefan@datenfreihafen.org>
Thu, 14 Jun 2012 15:01:37 +0000 (15:01 +0000)
strncmp() really does not like that. So we should not be lazy and check for it. Say thanks to
scan-build which reported these to me.

SVN revision: 72142

src/lib/elm_win.c

index 104c904..147c6e1 100644 (file)
@@ -2091,7 +2091,7 @@ elm_win_add(Evas_Object *parent,
           {
              tmp_sd.ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
           }
-        else if (!strncmp(_elm_preferred_engine, "shot:", 5))
+        else if (_elm_preferred_engine && !strncmp(_elm_preferred_engine, "shot:", 5))
           {
              tmp_sd.ee = ecore_evas_buffer_new(1, 1);
              ecore_evas_manual_render_set(tmp_sd.ee, EINA_TRUE);
@@ -2145,7 +2145,7 @@ elm_win_add(Evas_Object *parent,
      (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, sd);
 #endif
 
-   else if (!strncmp(_elm_preferred_engine, "shot:", 5))
+   else if (_elm_preferred_engine && !strncmp(_elm_preferred_engine, "shot:", 5))
      _shot_init(sd);
 
    sd->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;