Ticket #3652: listbox-fix-assertion-emptylist-asserts-rev0.diff

File listbox-fix-assertion-emptylist-asserts-rev0.diff, 1.2 KB (added by wwp, 8 years ago)

diff file against mc 4.8.17 sources

  • lib/widget/listbox.

    old new  
    5252/*** file scope macro definitions ****************************************************************/ 
    5353 
    5454/* Gives the position of the last item. */ 
    55 #define LISTBOX_LAST(l) ((l) && ((l)->list) && g_queue_is_empty ((l)->list) ? 0 : (int) g_queue_get_length ((l)->list) - 1) 
     55#define LISTBOX_LAST(l) (l == NULL || l->list == NULL || g_queue_is_empty ((l)->list) ? 0 : (int) g_queue_get_length ((l)->list) - 1) 
    5656 
    5757/*** file scope type declarations ****************************************************************/ 
    5858 
     
    229229static void 
    230230listbox_fwd (WListbox * l, gboolean wrap) 
    231231{ 
     232        if (l->list != NULL) 
     233        { 
    232234    if ((guint) l->pos + 1 < g_queue_get_length (l->list)) 
    233235        listbox_select_entry (l, l->pos + 1); 
    234236    else if (wrap) 
    235237        listbox_select_first (l); 
     238        } 
    236239} 
    237240 
    238241/* --------------------------------------------------------------------------------------------- */ 
     
    400403{ 
    401404    int action; 
    402405 
     406        if (l->list == NULL) 
     407                return; 
     408 
    403409    if (l->callback != NULL) 
    404410        action = l->callback (l); 
    405411    else