From aa439bff16f8c295a4d2e40fbf19cdc1b1521200 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 12 Aug 2021 20:44:11 -0700 Subject: [PATCH] tokenize(): Check all arguments 63a487d20df72e5ed64d1625217fb4257a3cc668 only checked for the last argument, not for all arguments. Fixes #822. --- desktop_version/src/Script.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index 6c9a294c..01175b23 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -73,15 +73,16 @@ void scriptclass::tokenize( const std::string& t ) } } + if (tempword != "" && j < (int) SDL_arraysize(words)) + { + words[j] = tempword; + } + SDL_zeroa(argexists); - if (j < (int) NUM_SCRIPT_ARGS) + for (size_t ii = 0; ii < NUM_SCRIPT_ARGS; ++ii) { - argexists[j] = tempword != ""; - if (argexists[j]) - { - words[j] = tempword; - } + argexists[ii] = words[ii] != ""; } }