(add_widget_autopos): don't access to NULL widget.

(del_widget): likewise.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-11-28 11:19:02 +04:00
parent 82b1d7bff3
commit 3fc490ea12
1 changed files with 6 additions and 2 deletions

View File

@ -858,12 +858,14 @@ unsigned long
add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const void *before)
{
Widget *wh = WIDGET (h);
Widget *widget = WIDGET (w);
Widget *widget;
/* Don't accept 0 widgets */
if (w == NULL)
abort ();
widget = WIDGET (w);
if ((pos_flags & WPOS_CENTER_HORZ) != 0)
widget->x = (wh->cols - widget->cols) / 2;
widget->x += wh->x;
@ -934,13 +936,15 @@ add_widget_before (WDialog * h, void *w, void *before)
void
del_widget (void *w)
{
WDialog *h = WIDGET (w)->owner;
WDialog *h;
GList *d;
/* Don't accept NULL widget. This shouldn't happen */
if (w == NULL)
abort ();
h = WIDGET (w)->owner;
d = g_list_find (h->widgets, w);
if (d == h->current)
h->current = dlg_widget_next (h, d);