#Adventure Rewards cause crashes when flipping some double sided cards

20 messages · Page 1 of 1 (latest)

surreal cedar
#

When flipping a double sided reward card, the alternate image can fail to load and cause a crash, either in post-match results or shops. This has been observed with several double sided cards, the only specific example I can point to at the moment is Hengegate Pathway (SLU 018) flipping to Mistgate Pathway.

#

Flipping this card results in a call to ImageUtil.getPaperCardFromImageKey("U/Mistgate Pathway.full"), which returns null. A subsequent call is made to T = renderPlaceholder(getGraphics(), altCard);, with altcard being the previous null result, which eventually spits out a null reference error and the application crashes.

    at forge.game.card.CardFactory.getCard(CardFactory.java:251)
    at forge.game.card.CardFactory.getCard(CardFactory.java:248)
    at forge.game.card.Card.fromPaperCard(Card.java:6723)
    at forge.game.card.Card.getCardForUi(Card.java:6739)
    at forge.game.card.CardView.getCardForUi(CardView.java:62)
    at forge.adventure.util.RewardActor.renderPlaceholder(RewardActor.java:459)
    at forge.adventure.util.RewardActor.switchTooltip(RewardActor.java:353)
    at forge.adventure.util.RewardActor.access$200(RewardActor.java:53)
    at forge.adventure.util.RewardActor$2.clicked(RewardActor.java:306)
    at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:88)
    at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:71)
    at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:355)
    at com.badlogic.gdx.InputEventQueue.drain(InputEventQueue.java:70)
    at com.badlogic.gdx.backends.lwjgl3.DefaultLwjgl3Input.update(DefaultLwjgl3Input.java:189)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window.update(Lwjgl3Window.java:378)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:192)
    at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:166)
    at forge.app.Main.main(Main.java:168)```
#

A quick and dirty fix would be to change line 327 of RewardActor.java to Texture alt = ImageCache.getImage(reward.getCard().getImageKey(true), TRUE);, enabling a blank default card to appear here. Doesn't fix the underlying problem (whatever it is, don't understand the framework enough yet to know why this image can't be loaded), but it does prevent the application from crashing.

#

Adventure Rewards cause crashes when flipping some double sided cards

quick star
#

Texture can be null so it shouldn't be a problem since it will not be displayed. The problem is why your image key is null or length is invalid?

surreal cedar
#

That's a good question, but one that I don't know how to answer just yet.

quick star
#

Also mistgate pathway the image key should start with kld, not U, i don't think that is the correct format..

surreal cedar
#

It was initially loading from "SLU/Mistgate Pathway.full", forget where but there's something that trims the first two characters off.

#

ImageUtil.getPaperCardFromImageKey() is what trimmed it I think

quick star
#

I think the check should be updated so it will find the correct card

surreal cedar
#

Oh, absolutely, I agree 110%, just saying that it doesn't crash if a default card is inserted.

surreal cedar
#

"Extus, Oriq Overlord" just did the same thing in a shop.

#

And yeah, I consider myself a returning addict, but I don't think I knew about Forge yet back then.

quick star
#

Well the dev added that substring before, maybe Forge uses only 2 set codes strings before...

surreal cedar
#

Perhaps sorted by rarity or color at the time with a smaller pool, and not set? First things I thought when I saw the "U/" was "uncommon" or "blue" until I traced back to find "SLU/..." as the original text.

#

Either way, I find it ironic that the biggest bugs I've encountered lately have been from clicking things that you don't necessarily have to click.

quick star
#

ok I found the issue 🙂

quick star