wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src game_events.cpp


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth/src game_events.cpp
Date: Tue, 14 Sep 2004 23:11:16 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    04/09/15 03:05:30

Modified files:
        src            : game_events.cpp 

Log message:
        fixed potential segfault (CVS internal)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_events.cpp.diff?tr1=1.103&tr2=1.104&r1=text&r2=text

Patches:
Index: wesnoth/src/game_events.cpp
diff -u wesnoth/src/game_events.cpp:1.103 wesnoth/src/game_events.cpp:1.104
--- wesnoth/src/game_events.cpp:1.103   Mon Sep 13 03:16:19 2004
+++ wesnoth/src/game_events.cpp Wed Sep 15 03:05:30 2004
@@ -1,4 +1,4 @@
-/* $Id: game_events.cpp,v 1.103 2004/09/13 03:16:19 Sirp Exp $ */
+/* $Id: game_events.cpp,v 1.104 2004/09/15 03:05:30 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -764,9 +764,9 @@
 
                        screen->invalidate(loc);
                } else {
-                  player_info 
*player=state_of_game->get_player((*teams)[new_unit.side()-1].save_id());
+                  player_info* const player = 
state_of_game->get_player((*teams)[new_unit.side()-1].save_id());
 
-                  if(player) {
+                  if(player != NULL) {
                     player->available_units.push_back(new_unit);
                   } else {
                     std::cerr << "Cannot create unit: location is not on the 
map, and player " << new_unit.side() << " has no recall list." << std::endl;
@@ -777,7 +777,11 @@
        //if we should recall units that match a certain description
        else if(cmd == "recall") {
           for(int index=0; index<teams->size(); ++index) {
-            player_info 
*player=state_of_game->get_player((*teams)[index].save_id());
+            player_info* const player = 
state_of_game->get_player((*teams)[index].save_id());
+
+                       if(player == NULL) {
+                               continue;
+                       }
 
             std::vector<unit>& avail = player->available_units;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]