Author: sveinung
Date: Wed Jul  1 21:09:58 2015
New Revision: 29192

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

to make it easier to blame it for segfaults.

See path #6108

Modified:
    branches/S2_6/client/client_main.c
    branches/S2_6/common/connection.c

Modified: branches/S2_6/client/client_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/client_main.c?rev=29192&r1=29191&r2=29192&view=diff
==============================================================================
--- branches/S2_6/client/client_main.c  (original)
+++ branches/S2_6/client/client_main.c  Wed Jul  1 21:09:58 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: branches/S2_6/common/connection.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/connection.c?rev=29192&r1=29191&r2=29192&view=diff
==============================================================================
--- branches/S2_6/common/connection.c   (original)
+++ branches/S2_6/common/connection.c   Wed Jul  1 21:09:58 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