https://bugs.documentfoundation.org/show_bug.cgi?id=152351
Bug ID: 152351
Summary: SF_Dictionary ReplaceItem does not accept array as
value
Product: LibreOffice
Version: 7.4.2.3 release
Hardware: All
OS: Windows (All)
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: BASIC
Assignee: [email protected]
Reporter: [email protected]
Description:
SF_Dictionary ReplaceItem does not accept array as input value.
If you do then an exception will be thrown.
In the code the switch for input value to check if is array is missing like we
see it in "Add"
Add:
If IsArray(Item) Then
If Not SF_Utils._ValidateArray(Item, "Item") Then GoTo
Catch
Else
If Not SF_Utils._Validate(Item, "Item") Then GoTo Catch
End If
ReplaceItem:
If Not SF_Utils._Validate(Value, "Value") Then GoTo Catch
Where ADD-"Item" = ReplaceItem-"Value"
Steps to Reproduce:
1. Dim myDict as Variant
2. myDict = CreateScriptService("Dictionary")
3. myDict.Add("key", Array())
4. myDict.ReplaceItem("key", Array())
Actual Results:
Exception with Text:
Library : ScriptForge
Service : Dictionary
Method : ReplaceItem
Arguments: Key, Value
A serious error has been detected in your code on argument : « Value ».
Validation rules :
The actual value of « Value » is : '[ARRAY] ()'
THE EXECUTION IS CANCELLED.
Do you want to receive more information about the 'ReplaceItem' method ?
Expected Results:
No Errors
Reproducible: Always
User Profile Reset: No
Additional Info:
ReplaceItem
Replaces an existing item value based on its key. Returns True if successful.
Syntax:
dict.ReplaceItem(key: str, value: any): bool
Parameters:
key: String value representing the key whose value will be replaced. Not
case-sensitive. If the key does not exist in the dictionary, an UNKNOWNKEYERROR
error is raised.
value: The new value of the item referred to with the key parameter.
Example:
myDict.Add("a", 1)
MsgBox(myDict.Item("a")) ' 1
myDict.ReplaceItem("a", 100)
MsgBox(myDict.Item("a")) ' 100
--
You are receiving this mail because:
You are the assignee for the bug.