cname() calls getnatp(), and returns a null pointer when it fails.
Some systems (GNU, Windows) deal gracefully with printing null
strings, others crash.
Because we keep table EF_NATION entirely in memory, getnatp() should
fail only on invalid country number.
Rewrite prnatid() to catch this error and recover.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
char *
prnatid(natid cnum)
{
- return prbuf("%s (#%d)", cname(cnum), cnum);
+ struct natstr *np = getnatp(cnum);
+
+ if (CANT_HAPPEN(!np))
+ return prbuf("%d (#%d)", cnum, cnum);
+ return prnat(np);
}