global-functions: update initialization of empty array

Having the parenthesis here is important for valid syntax!
This commit is contained in:
Christian Hesse 2022-07-13 11:32:44 +02:00
parent 99a8148d17
commit 9a89cd5407

View file

@ -585,7 +585,7 @@
# prepare NotificationFunctions array
:if ([ :typeof $NotificationFunctions ] != "array") do={
:set NotificationFunctions [ :toarray "" ];
:set NotificationFunctions ({});
}
# send notification via e-mail - expects one array argument
@ -612,7 +612,7 @@
}
:if ([ :typeof $EmailQueue ] = "nothing") do={
:set EmailQueue [ :toarray "" ];
:set EmailQueue ({});
}
:local Signature [ /system/note/get note ];
:set ($EmailQueue->[ :len $EmailQueue ]) {
@ -634,7 +634,7 @@
:if ([ :typeof $Source ] != "array") do={
:set Source [ :tostr $1 ];
}
:local Result [ :toarray "" ];
:local Result ({});
:foreach KeyValue in=[ :toarray $Source ] do={
:if ([ :find $KeyValue "=" ]) do={
:set ($Result->[ :pick $KeyValue 0 [ :find $KeyValue "=" ] ]) \
@ -974,10 +974,10 @@
:global ScriptLockOrder;
:if ([ :typeof $ScriptLockOrder ] = "nothing") do={
:set ScriptLockOrder [ :toarray "" ];
:set ScriptLockOrder ({});
}
:if ([ :typeof ($ScriptLockOrder->$Script) ] = "nothing") do={
:set ($ScriptLockOrder->$Script) [ :toarray "" ];
:set ($ScriptLockOrder->$Script) ({});
}
:local JobCount do={
@ -1052,7 +1052,7 @@
}
}
:set ($ScriptLockOrder->$Script) [ :toarray "" ];
:set ($ScriptLockOrder->$Script) ({});
}
:if ([ :len [ /system/script/find where name=$Script ] ] = 0) do={
@ -1065,7 +1065,7 @@
:if ([ $TicketCount $Script ] >= [ $JobCount $Script ]) do={
$LogPrintExit2 error $0 ("More tickets than running scripts '" . $Script . "', resetting!") false;
:set ($ScriptLockOrder->$Script) [ :toarray "" ];
:set ($ScriptLockOrder->$Script) ({});
/system/script/job/remove [ find where script=$Script ];
}