fixing strdup(NULL) call

This commit is contained in:
Enno Rehling 2008-04-26 23:04:37 +00:00
parent 93091caff0
commit 256d0b1d4b
1 changed files with 5 additions and 1 deletions

View File

@ -1650,7 +1650,11 @@ sp_undeadhero(fighter * fi, int level, double power, spell * sp)
/* new units gets some stats from old unit */ /* new units gets some stats from old unit */
free(u->display); free(u->display);
u->display = strdup(du->display); if (du->display) {
u->display = strdup(du->display);
} else {
u->display = NULL;
}
setstatus(u, du->status); setstatus(u, du->status);
setguard(u, GUARD_NONE); setguard(u, GUARD_NONE);