From 239d4069556739e809de9353fa099f2443622f1b Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 21 Jun 2004 13:46:11 +0000 Subject: [PATCH] Fix Gnome crash on up/down arrow and no history git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1436 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/gnome2-console/callbacks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bacula/src/gnome2-console/callbacks.c b/bacula/src/gnome2-console/callbacks.c index 0de9987a6e..8d6c187839 100644 --- a/bacula/src/gnome2-console/callbacks.c +++ b/bacula/src/gnome2-console/callbacks.c @@ -153,21 +153,33 @@ on_entry1_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_d gtk_entry_set_text((GtkEntry *)entry1, ""); } else if (event->keyval == KEY_Up) { if (!hc) { + if (!hist) { + return FALSE; + } hc = g_list_last(hist); } else { hc = g_list_previous(hc); } if (!hc) { + if (!hist) { + return FALSE; + } hc = g_list_first(hist); } gtk_entry_set_text((GtkEntry *)entry1, (gchar *)hc->data); } else if (event->keyval == KEY_Down) { if (!hc) { + if (!hist) { + return FALSE; + } hc = g_list_first(hist); } else { hc = g_list_next(hc); } if (!hc) { + if (!hist) { + return FALSE; + } hc = g_list_last(hist); } gtk_entry_set_text((GtkEntry *)entry1, (gchar *)hc->data); -- 2.39.5