Skip to content

Commit

Permalink
Merge pull request scp-fs2open#6386 from MjnMixael/fix_skip_to_string
Browse files Browse the repository at this point in the history
Return false if skip to string can't find the string
  • Loading branch information
TRBlount authored Oct 20, 2024
2 parents 83d1268 + a1a5780 commit 91a2291
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions code/scripting/api/libs/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,17 @@ ADE_FUNC(skipToString, l_Parsing, "string token", "Search for specified string,
}

try {
skip_to_string(str);
int found = skip_to_string(str);

if (found == 1) {
return ADE_RETURN_TRUE;
} else {
return ADE_RETURN_FALSE;
}
} catch (const parse::ParseException& e) {
mprintf(("PARSE: Error while parsing: %s\n", e.what()));
return ADE_RETURN_FALSE;
}

return ADE_RETURN_TRUE;
}

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

0 comments on commit 91a2291

Please sign in to comment.