diff --git a/src/kernel/save.c b/src/kernel/save.c index a27a6bae8..ef89b9daf 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1602,9 +1602,9 @@ int readgame(const char *filename, int backup) unit *u = read_unit(&gdata); sc_mage *mage; - if (gdata.version < AUTO_RACENAME_VERSION) { + if (gdata.version < JSON_REPORT_VERSION) { if (u->_name && fval(u->faction, FFL_NPC)) { - if (unit_name_equals_race(u)) { + if (!u->_name[0] || unit_name_equals_race(u)) { unit_setname(u, NULL); } } diff --git a/src/kernel/unit.c b/src/kernel/unit.c index a946caae0..0c6fcedd1 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -1649,7 +1649,7 @@ const char *unit_getname(const unit * u) void unit_setname(unit * u, const char *name) { free(u->_name); - if (name) + if (name && name[0]) u->_name = _strdup(name); else u->_name = NULL;