aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-02-18 13:09:57 +0100
committerThomas White <taw@physics.org>2021-02-18 13:09:57 +0100
commit705b7a94948cc8f0793c24efe00e36d2d2174085 (patch)
treef6d063054b770bced2bc6d9a1e59ccbb48db9ff2
parent831574153f9b9a3da24ed91bba323c25d385b1f1 (diff)
GUI: Avoid passing a few NULLs to GTK
-rw-r--r--src/gui_ambi.c4
-rw-r--r--src/gui_fom.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/gui_ambi.c b/src/gui_ambi.c
index d29ce6b0..0535dd99 100644
--- a/src/gui_ambi.c
+++ b/src/gui_ambi.c
@@ -225,7 +225,9 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->use_operator),
FALSE, FALSE, 4.0);
win->operator = gtk_entry_new();
- gtk_entry_set_text(GTK_ENTRY(win->operator), proj->ambi_params.operator);
+ if ( proj->ambi_params.operator != NULL ) {
+ gtk_entry_set_text(GTK_ENTRY(win->operator), proj->ambi_params.operator);
+ }
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(win->operator),
FALSE, FALSE, 4.0);
g_signal_connect(G_OBJECT(win->use_operator), "toggled",
diff --git a/src/gui_fom.c b/src/gui_fom.c
index 20c77da9..0de99018 100644
--- a/src/gui_fom.c
+++ b/src/gui_fom.c
@@ -652,8 +652,10 @@ gint fom_sig(GtkWidget *widget, struct crystfelproject *proj)
GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(f->cell_chooser),
TRUE);
- gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(f->cell_chooser),
- proj->fom_cell_filename);
+ if ( proj->fom_cell_filename != NULL ) {
+ gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(f->cell_chooser),
+ proj->fom_cell_filename);
+ }
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(f->cell_chooser),
FALSE, FALSE, 4.0);
button = gtk_button_new_from_icon_name("edit-clear",