summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/itemdb.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 7ea11ef7a..e0c964de3 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1171,12 +1171,22 @@ static int itemdb_readdb(void)
continue;
}
str[21] = p;
-
- p = strstr(p+1,"}");
- if ( strchr(p,',') != NULL )
- {
- ShowError("itemdb_readdb: Extra columns in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
- continue;
+
+ if ( str[21][strlen(str[21])-2] != '}' ) {
+ /* lets count to ensure it's not something silly e.g. a extra space at line ending */
+ int v, lcurly = 0, rcurly = 0;
+
+ for( v = 0; v < strlen(str[21]); v++ ) {
+ if( str[21][v] == '{' )
+ lcurly++;
+ else if ( str[21][v] == '}' )
+ rcurly++;
+ }
+
+ if( lcurly != rcurly ) {
+ ShowError("itemdb_readdb: Mismatching curly braces in line %d of \"%s\" (item with id %d), skipping.\n", lines, path, atoi(str[0]));
+ continue;
+ }
}
if (!itemdb_parse_dbrow(str, path, lines, 0))