You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When retrieving the Token VBL through getTokenVBL() and then at a later point setting that retrieved VBL with setTokenVBL() an error is given if the retrieved VBL is empty.
If the token never had any VBL the retrieved VBL is an empty string and the error message is: Unknown JSON type """" in function "setTokenVBL"
If the token had it's VBL cleared through the Clear Token VBL button on the VBL tab of the Edit Token Dialog, or set to an empty VBL by setting it's VBL to "{'shape':'none'}" with setTokenVBL() the error message is the following: Invalid end index "2" for array (size of 0) in function "setTokenVBL[Polygon]"
To Reproduce
Steps to reproduce the behavior:
Create a new token.
Add a new Macro to the token, uncheck "Allow Players to Edit Macro". Contents of the Macro are:
Run the macro on the token. At this point the Unknown JSON type """" in function "setTokenVBL" message is given
Open the Edit Dialog for the token. Go To the VBL tab and click the "Clear Token VBL" button, then clik on "OK" to close the dialog.
Run the macro on the token again. At this point the Invalid end index "2" for array (size of 0) in function "setTokenVBL[Polygon]" message is given.
Expected behavior
Retrieving the VBL from a Token and then later setting the VBL again with the retrieved VBL should always result in the original situation with exactly the same VBL (empty or not) on the token without errors.
Screenshots
If applicable, add screenshots to help explain your problem.
MapTool Info
Version: 1.9.0
Install: New (uninstalled 1.9.0 beta 3, then installed 1.9.0 in separate directory)
Desktop (please complete the following information):
OS: Windows 10 Pro
Version 10 - 2004
The text was updated successfully, but these errors were encountered:
For the Unknown JSON type... message, this is the result of getTokenVBL() exposing an implementation detail. If the token's VBL has never been set, and is therefore null, it returns an empty string. But if the VBL has been set and clear, it is now an empty Area and a polygon is returned (see below for more on this case). If we just change the null case to return an array as is done in the non-null case, the issue would go away.
The second message (Invalid end index...) equally affects getTokenVBL(), getVBL(), getHillVBL() and getPitVBL(). Each of these functions - when the retrieved VBL area is empty - will return a singleton array containing an empty polygon, which is not a valid shape. If these getters would instead return an empty array, then the setters would be able to consume the results.
Describe the bug
When retrieving the Token VBL through
getTokenVBL()
and then at a later point setting that retrieved VBL withsetTokenVBL()
an error is given if the retrieved VBL is empty.If the token never had any VBL the retrieved VBL is an empty string and the error message is:
Unknown JSON type """" in function "setTokenVBL"
If the token had it's VBL cleared through the Clear Token VBL button on the VBL tab of the Edit Token Dialog, or set to an empty VBL by setting it's VBL to
"{'shape':'none'}"
withsetTokenVBL()
the error message is the following:Invalid end index "2" for array (size of 0) in function "setTokenVBL[Polygon]"
To Reproduce
Steps to reproduce the behavior:
Unknown JSON type """" in function "setTokenVBL"
message is givenInvalid end index "2" for array (size of 0) in function "setTokenVBL[Polygon]"
message is given.Expected behavior
Retrieving the VBL from a Token and then later setting the VBL again with the retrieved VBL should always result in the original situation with exactly the same VBL (empty or not) on the token without errors.
Screenshots
If applicable, add screenshots to help explain your problem.
MapTool Info
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: