Author: cazfi
Date: Sun Apr 26 20:22:43 2015
New Revision: 28894

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

Reported by Renato <rcbrgs>

See bug #20110

Modified:
    branches/S2_4/server/ruleset.c

Modified: branches/S2_4/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/ruleset.c?rev=28894&r1=28893&r2=28894&view=diff
==============================================================================
--- branches/S2_4/server/ruleset.c      (original)
+++ branches/S2_4/server/ruleset.c      Sun Apr 26 20:22:43 2015
@@ -2831,6 +2831,7 @@
     char tmp[200] = "\0";
     const char *barb_type;
     const char *sec_name = section_name(section_list_get(sec, i));
+    const char *legend;
 
     /* Nation groups. */
     vec = secfile_lookup_str_vec(file, &dim, "%s.groups", sec_name);
@@ -3086,8 +3087,8 @@
     /* Read default city names. */
     load_city_name_list(file, pnation, sec_name, "cities");
 
-    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