Skip to content

Commit

Permalink
JADE: Catch exceptions in NWScript function StringToInt
Browse files Browse the repository at this point in the history
On error, it should return 0.
  • Loading branch information
DrMcCoy committed Nov 13, 2016
1 parent 06d320c commit acb0f5b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/engines/jade/script/functions_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ void Functions::intToHexString(Aurora::NWScript::FunctionContext &ctx) {

void Functions::stringToInt(Aurora::NWScript::FunctionContext &ctx) {
int32 i = 0;
Common::parseString(ctx.getParams()[0].getString(), i);

try {
Common::parseString(ctx.getParams()[0].getString(), i);
} catch (...) {
}

ctx.getReturn() = i;
}
Expand Down

0 comments on commit acb0f5b

Please sign in to comment.