Skip to content

Commit 91a2291

Browse files
authored
Merge pull request #6386 from MjnMixael/fix_skip_to_string
Return false if skip to string can't find the string
2 parents 83d1268 + a1a5780 commit 91a2291

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

code/scripting/api/libs/parse.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,17 @@ ADE_FUNC(skipToString, l_Parsing, "string token", "Search for specified string,
9595
}
9696

9797
try {
98-
skip_to_string(str);
98+
int found = skip_to_string(str);
99+
100+
if (found == 1) {
101+
return ADE_RETURN_TRUE;
102+
} else {
103+
return ADE_RETURN_FALSE;
104+
}
99105
} catch (const parse::ParseException& e) {
100106
mprintf(("PARSE: Error while parsing: %s\n", e.what()));
101107
return ADE_RETURN_FALSE;
102108
}
103-
104-
return ADE_RETURN_TRUE;
105109
}
106110

107111
ADE_FUNC(requiredString, l_Parsing, "string token", "Require that a string appears at the current position.", "boolean",

0 commit comments

Comments
 (0)