1
0
Fork 0

Codechange: [Script] Don't report multiple errors on valuator/filter failure (#14303)

pull/14311/head
Loïc Guilloux 2025-05-30 14:38:41 +02:00 committed by GitHub
parent 10c159a79f
commit 2cd3c8db86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 15 deletions

View File

@ -2112,6 +2112,11 @@ function Regression::Start()
local list = AIList();
list.AddItem(0, 0);
local Infinite = function(id) { while(true); }
try {
list = AIIndustryList(Infinite);
} catch (e) {
print("constructor failed with: " + e);
}
list.Valuate(Infinite);
}

View File

@ -9792,20 +9792,10 @@ ERROR: IsEnd() is invalid as Begin() is never called
-2147483648 > 2147483647: false
13725 > -2147483648: true
--Valuate() with excessive CPU usage--
constructor failed with: excessive CPU usage in list filter function
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [unknown()] regression/main.nut line [2114]
*FUNCTION [Valuate()] NATIVE line [-1]
*FUNCTION [Start()] regression/main.nut line [2115]
[id] 0
[this] TABLE
[Infinite] CLOSURE
[list] INSTANCE
[this] INSTANCE
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [Start()] regression/main.nut line [2115]
*FUNCTION [Start()] regression/main.nut line [2120]
[Infinite] CLOSURE
[list] INSTANCE

View File

@ -932,7 +932,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
}
/* Call the function. Squirrel pops all parameters and pushes the return value. */
if (SQ_FAILED(sq_call(vm, nparam + 1, SQTrue, SQTrue))) {
if (SQ_FAILED(sq_call(vm, nparam + 1, SQTrue, SQFalse))) {
ScriptObject::SetAllowDoCommand(backup_allow);
return SQ_ERROR;
}

View File

@ -111,9 +111,9 @@ protected:
}
/* Call the function. Squirrel pops all parameters and pushes the return value. */
if (SQ_FAILED(sq_call(vm, nparam + 1, SQTrue, SQTrue))) {
if (SQ_FAILED(sq_call(vm, nparam + 1, SQTrue, SQFalse))) {
ScriptObject::SetAllowDoCommand(backup_allow);
throw sq_throwerror(vm, "failed to run filter");
throw static_cast<SQInteger>(SQ_ERROR);
}
SQBool add = SQFalse;