Skip to content

Commit af19834

Browse files
author
runrevali
committed
[[ LiveCode Builder ]] Throw error when trying to parse a non-numeric string as number
1 parent 5b27dd8 commit af19834

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

libscript/src/module-arithmetic.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,10 @@ extern "C" MC_DLLEXPORT void MCArithmeticEvalStringParsedAsNumber(MCStringRef p_
458458
{
459459
double t_converted;
460460
if (!MCTypeConvertStringToReal(p_operand, t_converted))
461+
{
462+
MCErrorCreateAndThrow(kMCGenericErrorTypeInfo, "reason", MCSTR("input string is not a number"), nil);
461463
return;
464+
}
462465

463466
if (!MCNumberCreateWithReal(t_converted, r_output))
464467
return;

0 commit comments

Comments
 (0)