From 6e9b5966a57f270b80ec930464c68f87e709c645 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 30 Dec 2007 18:23:45 +0000 Subject: [PATCH] (gtk) fix ticket #560, faulty handling of bad command-line options --- gtk/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gtk/main.c b/gtk/main.c index 4bd803022..d5d92b19d 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -221,6 +221,7 @@ main( int argc, char ** argv ) char * err; struct cbdata * cbdata = g_new (struct cbdata, 1); GList * argfiles; + GError * gerr; gboolean didinit = FALSE; gboolean didlock = FALSE; gboolean sendquit = FALSE; @@ -242,7 +243,13 @@ main( int argc, char ** argv ) /* initialize gtk */ g_thread_init( NULL ); - gtk_init_with_args( &argc, &argv, _("[torrent files]"), entries, domain, NULL ); + gerr = NULL; + if( !gtk_init_with_args( &argc, &argv, _("[torrent files]"), entries, domain, &gerr ) ) { + g_message( "%s", gerr->message ); + g_clear_error( &gerr ); + return 0; + } + didinit = cf_init( tr_getPrefsDirectory(), NULL ); /* must come before actions_init */ tr_prefs_init_global( ); myUIManager = gtk_ui_manager_new ();