magefree / magefree/mage

Incorrect log text with {this}, and NullPointerException on hover, for texts of copied abilities

Open
#13,268 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

Tested on most recent commit at time of writing. (266f5ee3b71f796493b359c6a10b3219dd3b0fc1)

To reproduce:

1. Activate or trigger an ability, with or without {this} in its text.
2. Copy that ability using e.g. Lithoform Engine.

Expected results:
The log explaining what just happened includes the text of the ability with "{this}" replaced by the proper name if necessary.
You can hover over the highlighted stack ability in the log for more information.

Actual results:
If present, the literal text "{this}" is kept in the log.
If it was a triggered ability, hovering over the highlighted text for the ability instantly results in a NPE (log below).

Example hover text copying the ETB of a Navigator's Compass:
12:06 AM, T2.M1: Human activates: copy target activated or triggered ability you control. You may choose new targets for the copy. from Lithoform Engine [749] targeting stack ability (When {this} enters, you gain 3 life.) [0c2]

---
Error type: CLIENT - unhandled error in GUI - NullPointerException

Client version: 1.4.55-V3 (build: runtime)
Java version: 11.0.25
Default charset: UTF-8

NullPointerException - look at server or client logs for more details

Stack trace:
mage.client.util.gui.GuiDisplayUtil.replaceNamesInRule(GuiDisplayUtil.java:432)
mage.client.util.gui.GuiDisplayUtil.getRulesFromCardView(GuiDisplayUtil.java:409)
org.mage.plugins.card.info.CardInfoPaneImpl.lambda$setCard$0(CardInfoPaneImpl.java:56)
java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
java.base/java.security.AccessController.doPrivileged(Native Method)
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
and other 6 lines

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the copied-ability cases, then start with GuiDisplayUtil.replaceNamesInRule and getRulesFromCardView, followed by CardInfoPaneImpl.setCard as shown in the stack trace. Verify that copied ability log text resolves {this} correctly and that hovering the highlighted triggered ability no longer produces a NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.