summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/mob.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index a2122d6..ebd336f 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -3415,13 +3415,13 @@ int mob_readdb(void)
{
int mob_class;
- if (line.startswith("//"))
+ if (!line || line.startswith("//"))
continue;
struct mob_db_ mdbv {};
XString ignore;
- extract(line, record<','>(
+ bool okay = extract(line, record<','>(
&mob_class,
lstripping(&mdbv.name),
lstripping(&mdbv.jname),
@@ -3482,8 +3482,11 @@ int mob_readdb(void)
)
);
- if (mob_class <= 1000 || mob_class > 2000)
+ if (!okay || mob_class <= 1000 || mob_class > 2000)
+ {
+ PRINTF("bad mob line: %s\n", line);
continue;
+ }
// TODO move this lower
mob_db[mob_class] = std::move(mdbv);