aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-02-08 14:14:25 +0100
committerThomas White <taw@physics.org>2010-02-08 14:14:25 +0100
commitad83a462d3707a94efb3c5d0f99db95bf6e02621 (patch)
tree6c1f5c3a9557b5132b9cbc5770d74e0e2b37d6cd
parent5c2b33d79e64d42d8be2a274b20796c86418c688 (diff)
Don't crash so badly when given a bad image
-rw-r--r--src/displaywindow.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c
index 0de3e9d1..542917be 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -744,6 +744,8 @@ static GtkWidget *displaywindow_addhdfgroup(struct hdfile *hdfile,
GSList *rg = NULL;
int n, i;
+ if ( hdfile == NULL ) return NULL;
+
names = hdfile_read_group(hdfile, &n, group, &is_group, &is_image);
if ( n == 0 ) return NULL;
@@ -1020,7 +1022,7 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
g_signal_connect(GTK_OBJECT(dw->drawingarea), "button-release-event",
G_CALLBACK(displaywindow_release), dw);
- displaywindow_update_menus(dw);
+ if ( dw->hdfile != NULL ) displaywindow_update_menus(dw);
return dw;
}