Skip to content

Commit

Permalink
KOTOR2: Fix FindSubString for "not found"
Browse files Browse the repository at this point in the history
Assigning to ctx.Return() doesn't actually return from the function.
  • Loading branch information
DrMcCoy committed Nov 4, 2016
1 parent 46d6f19 commit c2228bd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/engines/kotor2/script/functions_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ void Functions::findSubString(Aurora::NWScript::FunctionContext &ctx) {
const Common::UString &str = ctx.getParams()[0].getString();
const Common::UString &sub = ctx.getParams()[1].getString();

ctx.getReturn() = -1;

Common::UString::iterator it = str.findFirst(sub);
if (it == str.end())
ctx.getReturn() = -1;
return;

ctx.getReturn() = (int32) str.getPosition(it);
}
Expand Down

0 comments on commit c2228bd

Please sign in to comment.