From: Carl Worth Date: Tue, 22 Jan 2008 01:02:59 +0000 (-0800) Subject: Don't try to close connection if it's never been opened X-Git-Url: https://git.cworth.org/git?p=loudgame;a=commitdiff_plain;h=6e8ab3d68b2c0e5c9874a3d2f4ba34de56efa6b8;ds=sidebyside Don't try to close connection if it's never been opened --- diff --git a/loudgame.c b/loudgame.c index d99a0d2..65aeb35 100644 --- a/loudgame.c +++ b/loudgame.c @@ -33,11 +33,16 @@ loudgame_quit (loudgame_t *lg, int return_value) lg->return_value = return_value; - if (! lm_connection_close (lg->connection, &error)) - g_print ("An error occurred during lm_connection_close: %s\n", - error->message); - - lm_connection_unref (lg->connection); + if (lg->connection) + { + if (! lm_connection_close (lg->connection, &error)) + { + g_print ("An error occurred during lm_connection_close: %s\n", + error->message); + } + lm_connection_unref (lg->connection); + lg->connection = NULL; + } g_main_loop_quit (lg->main_loop); }