From 05f8f9d4f74aab05f507ec8e08a56f27ba9c2c8e Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Wed, 7 Aug 2013 13:17:23 -0700 Subject: Fix a refactoring bug in mob_db parsing, give better errors --- src/map/mob.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/map/mob.cpp') 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); -- cgit v1.2.3-60-g2f50