Author: sveinung
Date: Sun Jul 24 05:22:39 2016
New Revision: 33306

URL: http://svn.gna.org/viewcvs/freeciv?rev=33306&view=rev
Log:
Don't crash on savegame error reporting.

Say "missing" rather than trying to print the name of the missing extra the
activity target.

See bug #24868

Modified:
    trunk/server/savegame2.c
    trunk/server/savegame3.c

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=33306&r1=33305&r2=33306&view=diff
==============================================================================
--- trunk/server/savegame2.c    (original)
+++ trunk/server/savegame2.c    Sun Jul 24 05:22:39 2016
@@ -2679,8 +2679,11 @@
     unit_list_iterate(pplayer->units, punit) {
       if (!can_unit_continue_current_activity(punit)) {
         log_sg("Unit doing illegal activity in savegame!");
-        log_sg("Activity: %s, Target: %s", unit_activity_name(punit->activity),
-               extra_rule_name(punit->activity_target));
+        log_sg("Activity: %s, Target: %s",
+               unit_activity_name(punit->activity),
+               punit->activity_target ? extra_rule_name(
+                                          punit->activity_target)
+                                      : "missing");
         punit->activity = ACTIVITY_IDLE;
       }
     } unit_list_iterate_end;

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=33306&r1=33305&r2=33306&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Sun Jul 24 05:22:39 2016
@@ -3482,8 +3482,11 @@
     unit_list_iterate(pplayer->units, punit) {
       if (!can_unit_continue_current_activity(punit)) {
         log_sg("Unit doing illegal activity in savegame!");
-        log_sg("Activity: %s, Target: %s", unit_activity_name(punit->activity),
-               extra_rule_name(punit->activity_target));
+        log_sg("Activity: %s, Target: %s",
+               unit_activity_name(punit->activity),
+               punit->activity_target ? extra_rule_name(
+                                          punit->activity_target)
+                                      : "missing");
         punit->activity = ACTIVITY_IDLE;
       }
     } unit_list_iterate_end;


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

Reply via email to