summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/newgrf_gui.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 47a5e91a8..deeb17f4a 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -32,13 +32,12 @@ static int parse_intlist(const char *p, int *items, int maxitems)
char *end;
for (;;) {
+ while (*p == ' ' || *p == ',') p++;
+ if (*p == '\0') break;
v = strtol(p, &end, 0);
if (p == end || n == maxitems) return -1;
p = end;
items[n++] = v;
- if (*p == '\0') break;
- if (*p != ',' && *p != ' ') return -1;
- p++;
}
return n;