[Genlist] Add more pointer checking
authorTae-Hwan Kim <the81.kim@samsung.com>
Mon, 29 Apr 2013 14:36:01 +0000 (23:36 +0900)
committerSungho Kwak <sungho1.kwak@samsung.com>
Wed, 12 Jun 2013 04:39:05 +0000 (13:39 +0900)
Change-Id: I32ddb1a66acc1fbd918ace2c3ff8d619ee35a166

src/lib/elm_genlist.c

index 5f0eedb..70eed93 100644 (file)
@@ -811,35 +811,30 @@ _calc_job(void *data)
         if (!sd->must_recalc_idler)
           sd->must_recalc_idler = ecore_idler_add(_must_recalc_idler, sd);
      }
-   if (sd->check_scroll)
+   if (sd->check_scroll && sd->show_item && sd->show_item->item->block)
      {
         _elm_genlist_pan_smart_content_size_get(sd->pan_obj, &pan_w, &pan_h);
-        if (EINA_INLIST_GET(sd->show_item) == sd->items->last)
+        if (sd->items && (EINA_INLIST_GET(sd->show_item) == sd->items->last))
           sd->scroll_to_type = ELM_GENLIST_ITEM_SCROLLTO_IN;
 
-        switch (sd->scroll_to_type)
+        if (sd->scroll_to_type == ELM_GENLIST_ITEM_SCROLLTO_TOP)
           {
-           case ELM_GENLIST_ITEM_SCROLLTO_TOP:
              dy = sd->h;
-             break;
-
-           case ELM_GENLIST_ITEM_SCROLLTO_MIDDLE:
+          }
+        else if (sd->scroll_to_type == ELM_GENLIST_ITEM_SCROLLTO_MIDDLE)
+          {
              dy = sd->h / 2;
-             break;
-
-           case ELM_GENLIST_ITEM_SCROLLTO_IN:
-           default:
+          }
+        else
+          {
              dy = 0;
-             break;
           }
-        if ((sd->show_item) && (sd->show_item->item->block))
+
+        if ((pan_w > (sd->show_item->x + sd->show_item->item->block->x))
+            && (pan_h > (sd->show_item->y + sd->show_item->item->block->y
+                         + dy)))
           {
-             if ((pan_w > (sd->show_item->x + sd->show_item->item->block->x))
-                 && (pan_h > (sd->show_item->y + sd->show_item->item->block->y
-                              + dy)))
-               {
-                  _item_scroll(sd);
-               }
+             _item_scroll(sd);
           }
      }