SF_Dictionary: tdf#152351 Fix ReplaceItem does not accept array as value
Next basic code
Dim myDict as Variant
myDict = CreateScriptService("Dictionary")
myDict.Add("key", Array())
myDict.ReplaceItem("key", Array(1, 2, 3))
produces an error message incriminating the user code.
While it should run normally ...
Fixed by enlarging the validation rules.
Patch on master: https://gerrit.libreoffice.org/c/core/+/144041
Change-Id: I9055ec61a0ec1fbe9d92bdbaf24d8d34ebf62770
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144053
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
diff --git a/wizards/source/scriptforge/SF_Dictionary.xba b/wizards/source/scriptforge/SF_Dictionary.xba
index 367fc47..22ada51 100644
--- a/wizards/source/scriptforge/SF_Dictionary.xba
+++ b/wizards/source/scriptforge/SF_Dictionary.xba
@@ -751,7 +751,11 @@ Const cstSubArgs = "Key, Value"
Check:
If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
If Not SF_Utils._Validate(Key, "Key", V_STRING) Then GoTo Catch
If Not SF_Utils._Validate(Value, "Value") Then GoTo Catch
If IsArray(Value) Then
If Not SF_Utils._ValidateArray(Value, "Value") Then GoTo Catch
Else
If Not SF_Utils._Validate(Value, "Value") Then GoTo Catch
End If
End If
If Not Exists(Key) Then GoTo CatchUnknown