Fix per-set argument parsing in standalone
diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp
index c6dc597..e62f92f 100644
--- a/StandAlone/StandAlone.cpp
+++ b/StandAlone/StandAlone.cpp
@@ -347,13 +347,13 @@
lang = FindLanguage(argv[arg++], false);
}
- if ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
+ if ((argc - arg) >= 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
// Parse a per-set binding base
- while ((argc - arg) > 2 && isdigit(argv[arg+0][0]) && isdigit(argv[arg+1][0])) {
+ do {
const int baseNum = atoi(argv[arg++]);
const int setNum = atoi(argv[arg++]);
perSetBase[setNum] = baseNum;
- }
+ } while ((argc - arg) >= 2 && isdigit(argv[arg + 0][0]) && isdigit(argv[arg + 1][0]));
} else {
// Parse single binding base
singleBase = atoi(argv[arg++]);