Author: sveinung
Date: Wed Jul  1 21:09:38 2015
New Revision: 29191

URL: http://svn.gna.org/viewcvs/freeciv?rev=29191&view=rev
Log:
Add some assertions near all_connections

to make it easier to blame it for segfaults.

See path #6108

Modified:
    trunk/client/client_main.c
    trunk/common/connection.c

Modified: trunk/client/client_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/client_main.c?rev=29191&r1=29190&r2=29191&view=diff
==============================================================================
--- trunk/client/client_main.c  (original)
+++ trunk/client/client_main.c  Wed Jul  1 21:09:38 2015
@@ -968,6 +968,9 @@
 **************************************************************************/
 void client_remove_cli_conn(struct connection *pconn)
 {
+  fc_assert_msg(pconn != NULL,
+                "Trying to remove a non existing connection");
+
   if (NULL != pconn->playing) {
     conn_list_remove(pconn->playing->connections, pconn);
   }
@@ -983,6 +986,9 @@
 **************************************************************************/
 void client_remove_all_cli_conn(void)
 {
+  fc_assert_msg(game.all_connections != NULL,
+                "Connection list missing");
+
   while (conn_list_size(game.all_connections) > 0) {
     struct connection *pconn = conn_list_get(game.all_connections, 0);
     client_remove_cli_conn(pconn);

Modified: trunk/common/connection.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/connection.c?rev=29191&r1=29190&r2=29191&view=diff
==============================================================================
--- trunk/common/connection.c   (original)
+++ trunk/common/connection.c   Wed Jul  1 21:09:38 2015
@@ -413,6 +413,9 @@
 struct connection *conn_by_number(int id)
 {
   conn_list_iterate(game.all_connections, pconn) {
+    fc_assert_msg(pconn != NULL,
+                  "Trying to look at the id of a non existing connection");
+
     if (pconn->id == id) {
       return pconn;
     }


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to