-
Notifications
You must be signed in to change notification settings - Fork 271
Open
Labels
Description
Describe the Bug
When the /table command encounters a value that does not match any table entry, it does not properly report the failure to find an entry. Instead:
- If the value is too low, it returns the entry with the lowest minimum for its range
- If the value is too high, it returns the entry with the greatest maximum for its range
- If the value is between entries, it throws an NullPointerException
Essentially the same thing happens with the table() and tableImage() macro functions. Notably, getTableEntry() does not share any of this behaviour.
To Reproduce
- Create a new campaign.
- Add a new table called "test" with these rows:
- 1 => one
- 3 => three
- In chat, type this:
/table test 0. It will printTable test (Anonymous User): onedespite not matching. - In chat, type this:
/table test 4. It will printTable test (Anonymous User): three. despite not matching. - In chat, type this:
/table test 2. It will print this error message:Could not execute the command: "table test 2", exception = Cannot invoke "net.rptools.maptool.model.LookupTable$LookupEntry.getValue()" because "result" is null - Repeat the same steps using
table()andtableImage()instead of/table. These return results for the same table entries as/table, but when passing2, the error message is even less helpful:Error in body of roll. Statement options (if any): r Statement Body : table("test", 2) Error trace : chat
Expected Behaviour
When the /table command cannot find a matching entry, it should not print anything to chat, i.e., the result should be an empty string. This should hold whether the value is too low, too high, or encounters a gap in the table.
Screenshots
No response
MapTool Info
1.18.5
Desktop
Linux Mint 22.1
Additional Context
No response