Don't try to close connection if it's never been opened
authorCarl Worth <cworth@cworth.org>
Tue, 22 Jan 2008 01:02:59 +0000 (17:02 -0800)
committerCarl Worth <cworth@cworth.org>
Tue, 22 Jan 2008 01:02:59 +0000 (17:02 -0800)
loudgame.c

index d99a0d2e3677ba039b6bfa950870770e2d64ef9f..65aeb35f31ab95cfe420dbfb526b874b6997f452 100644 (file)
@@ -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);
 }