chiark / gitweb /
[PATCH] fix SEGV in libsysfs/dlist.c
[elogind.git] / libsysfs / dlist.c
index 942eccb48c89850a83e7806318a3803641fe68a3..b440d65bed0f0f1fb7b8be5fa69999c6ba8a0692 100644 (file)
@@ -74,14 +74,14 @@ inline void *_dlist_mark_move(Dlist *list,int direction)
 {
   if(direction)
     {
-      if( list->marker->next!=NULL)
+      if( list->marker && list->marker->next!=NULL)
        list->marker=list->marker->next;
       else
        return(NULL);
     }
   else
     {
-      if( list->marker->prev!=NULL)
+      if( list->marker && list->marker->prev!=NULL)
        list->marker=list->marker->prev;
       else
        return(NULL);