Author: cazfi
Date: Sun Apr 26 20:22:35 2015
New Revision: 28893

URL: http://svn.gna.org/viewcvs/freeciv?rev=28893&view=rev
Log:
Fixed a crash when nation legend is missing

Reported by Renato <rcbrgs>

See bug #20110

Modified:
    branches/S2_5/server/ruleset.c

Modified: branches/S2_5/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/ruleset.c?rev=28893&r1=28892&r2=28893&view=diff
==============================================================================
--- branches/S2_5/server/ruleset.c      (original)
+++ branches/S2_5/server/ruleset.c      Sun Apr 26 20:22:35 2015
@@ -3846,6 +3846,7 @@
       char tmp[200] = "\0";
       const char *barb_type;
       const char *sec_name = section_name(section_list_get(sec, i));
+      const char *legend;
 
       /* Nation sets and groups. */
       if (default_set >= 0) {
@@ -4240,8 +4241,8 @@
         break;
       }
 
-      pnation->legend = fc_strdup(secfile_lookup_str(file, "%s.legend",
-                                                     sec_name));
+      legend = secfile_lookup_str_default(file, "", "%s.legend", sec_name);
+      pnation->legend = fc_strdup(legend);
       if (check_strlen(pnation->legend, MAX_LEN_MSG, NULL)) {
         ruleset_error(LOG_ERROR,
                       "Nation %s: legend \"%s\" is too long.",


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

Reply via email to