Skip to content

[Bug]: NPE when onCampaignLoad creates Lib:Token #5969

@Jmr3366

Description

@Jmr3366

Describe the Bug

When you create a library token through onCampaignLoad, you can produce the attached NPE error on the server when the player connects for the first time. Subsequent reconnects do not produce the error. To reproduce a second time you have to delete the Lib:token that was created, and close the MapTool server session, open MapTool, load the campaign, start server, issue should repeat

Image

To Reproduce

On an existing Library token, create an onCampaignLoad macro.
This code:

[h: tokenImage = getTokenImage("",findToken(getMacroLocation()))]
[h: tokenTemplate = json.set("{}", 
	"name", tokenName,
	"tokenImage", tokenImage,
	"size","medium",
	"layer","token",
	"gmName","",
	"relativeto", "map",
	"x", 0,
	"y", 0
)]
[h: tokenID = createToken(tokenTemplate)]

Expected Behaviour

A meaningful error if it is a real failure or "" if it's a false/positive

If true/positive I'd expect it to be somehow mitigated (not exactly sure how yet though)

Screenshots

MapTool Info

v1.18.6

Desktop

Win 11

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions