diff options
author | Alan Fitton <alan@eth0.org.uk> | 2012-08-13 07:23:52 +0100 |
---|---|---|
committer | Alan Fitton <alan@eth0.org.uk> | 2012-08-13 07:23:52 +0100 |
commit | 189a7111324b5076d2414a83d237f41156d95e2f (patch) | |
tree | 00b928d36a083045b023ca7556dd93983922a8d0 /src/trg-gtk-app.c | |
parent | 20c5f5f3c2c9e2f2f415003dc3af92ac4dffae81 (diff) |
fix a possible and rare NULL ptr dereference in an abrt crash report I got, run GTK init before converting command line arguments to hopefully avoid GTK/glib debugging flags being passed as torrent filenames.
Diffstat (limited to 'src/trg-gtk-app.c')
-rw-r--r-- | src/trg-gtk-app.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/trg-gtk-app.c b/src/trg-gtk-app.c index afc07be..e0ddcf2 100644 --- a/src/trg-gtk-app.c +++ b/src/trg-gtk-app.c @@ -99,8 +99,14 @@ trg_gtk_app_command_line(GApplication * application, { GList *windows = gtk_application_get_windows(GTK_APPLICATION(application)); - TrgMainWindow *window = TRG_MAIN_WINDOW(windows->data); - gchar **argv = g_application_command_line_get_arguments(cmdline, NULL); + TrgMainWindow *window; + gchar **argv; + + if (!windows || !windows->data) + return 1; + + window = TRG_MAIN_WINDOW(windows->data); + argv = g_application_command_line_get_arguments(cmdline, NULL); if (g_application_command_line_get_is_remote(cmdline)) { if (!argv[0]) { |