Repository navigation
Work out the tileset columns when the columns attribute is missing - #196
Merged
fallahn merged 1 commit intoDec 4, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tiled before 0.15 writes
tilecounton the tileset but notcolumns. tmxlite reads the missing attribute as 0, and when the tileset doesn't list every tile,createMissingTiledivides bym_columnCount, so loading such a map crashes with a division by zero (SIGFPE):Changes:
columnsattribute is missing, work it out from the image width the same way Tiled does (Tileset::columnCountForWidth:(width - margin + spacing) / (tileWidth + spacing)), so the tiles get their image positions.createMissingTilewhen the column count is 0, likeparseTileNodealready does.Test:
maps/no_columns.tmxhas two tilesets withoutcolumns(one with spacing and margin) andtestTilesetWithoutColumnschecks the column counts and tile image positions. Without the fix ParseTest crashes at that test; with it every check passes (built with-fsanitize=address,undefined).