Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Java NPE Prints In Chat Upon All On-Map Mouse Clicks #3316

Closed
StowGnar opened this issue Jan 5, 2022 · 3 comments
Closed

[Bug]: Java NPE Prints In Chat Upon All On-Map Mouse Clicks #3316

StowGnar opened this issue Jan 5, 2022 · 3 comments
Assignees
Labels

Comments

@StowGnar
Copy link

StowGnar commented Jan 5, 2022

Describe the Bug

Every mouseclick in the map window (though not in any of the dockable windows, I believe) caused this error message to be printed out in plaintext in the Chat:

java.lang.NullPointerException: Cannot invoke "java.awt.Rectangle.getX()" because the return value of "com.jidesoft.docking.DockContext.getUndockedBounds()" is null error executing expression IFS = json.get(getInfo("client"),"isFullScreen").
Error trace : buttonHandler@Lib:OnTokenMove <<< macroLink

I was told "That error is a problem with the Java code not checking for a null return value, not an MTscript issue." by Azhrei. Unfortunately, I ended up going to bed and restarting my PC before writing this report, and the error now does not persist upon having reconnected. My apologies for losing a more preserved copy of the error and the steps to reproduce it. I can say this did occur after running a series of Bag of Tricks macros, if I recall correctly.

To Reproduce

Unknown, other than Bag of Tricks and its onTokenMove's buttonHandler macro being involved (obviously). However, it sounded like a more universal issue than just BoT by the way Azhrei described, so this is probably only one way of reaching the same NPE.

Expected Behaviour

Click anywhere and only receive relevant data/feedback from those clicks.

Screenshots

I foolishly did not screenshot the NPE in chat, only copied the text as above.

MapTool Info

1.11.4

Desktop

Windows 10

Additional Context

Two different client instances (one player, one GM) were open and connected to remote server on a VPS. NPE started being printed to chat after local GM instance ran series of BoT macros.

@kwvanderlinde
Copy link
Collaborator

I believe I have a consistent way to reproduce this for testing purposes:

  1. Run this macro to open a frame: [r, frame5("3316 test", "temporary=0"): { }]
  2. Dock the frame somewhere
  3. Window > Restore Layout
  4. Run [r: getInfo("client")] in chat

At this point, MapTool remembers that the frame was docked and will automatically dock it whenever it is reopened. So if you close and reopen MapTool, you'll notice first that [r: getInfo("client")] starts to work. But once you reopen the frame as in step (1), it will start to fail again.

@Pmofmalasia
Copy link

The method given does not reproduce the bug for me in 1.13.2 - though I have not tested 1.12.x to see if it worked for me there.

@kwvanderlinde
Copy link
Collaborator

Thanks @Pmofmalasia! That should be a consistent reproduction, so I'll consider that independent validation.

@github-project-automation github-project-automation bot moved this from Needs Testing to Merged in MapTool 1.13.0 Aug 17, 2023
@kwvanderlinde kwvanderlinde moved this from Merged to Done in MapTool 1.13.0 Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

3 participants