Skip to content

Fix LandBrush Manager crash on missing texmaps; fall back to land art#80

Open
thefrsx wants to merge 1 commit into
kaczy93:masterfrom
thefrsx:fix/landbrush-art-fallback
Open

Fix LandBrush Manager crash on missing texmaps; fall back to land art#80
thefrsx wants to merge 1 commit into
kaczy93:masterfrom
thefrsx:fix/landbrush-art-fallback

Conversation

@thefrsx

@thefrsx thefrsx commented Jun 25, 2026

Copy link
Copy Markdown

Problem

Opening Tool → LandBrush Manager and selecting a brush crashes the app:

System.NullReferenceException
   at LandBrushManagerWindow.CalculateButtonTexture(UInt16 tileId)
   at LandBrushManagerWindow.DrawTransitions()

CalculateButtonTexture falls back to the 0x0001 VOID texmap when a tile's texmap is missing, but if that fallback is also absent (art sets that ship without texmaps), spriteInfo.Texture is null and tex.Width throws. DrawTransitions has no try/catch, so the whole app goes down. Hit this on a shard whose texidx.mul had no valid entries.

Fix

  • Guard the null texture in CalculateButtonTexture (return an empty texture ref instead of dereferencing null).
  • In both DrawTile and CalculateButtonTexture, fall back to the flat land art via Arts.GetLand(...), the same way TilesWindow resolves land previews — so brush/transition thumbnails still render when texmaps are unavailable.

No behavior change when texmaps are present.

CalculateButtonTexture dereferenced a null Texture when both the tile's
texmap and the 0x0001 VOID fallback were absent (e.g. art sets shipped
without texmaps). This threw a NullReferenceException in DrawTransitions,
crashing the app when selecting a brush in the LandBrush Manager.

Guard the null texture, and in both DrawTile and CalculateButtonTexture
fall back to the flat land art (Arts.GetLand) exactly as TilesWindow does,
so brush and transition previews render even when texmaps are unavailable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant