Skip to content

Commit 5f94110

Browse files
committed
Fix crash if offset would assign non-positive ids to tiles
1 parent 9f4f4bf commit 5f94110

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/supertux/tile_set_parser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ TileSetParser::TileSetParser(TileSet& tileset, const std::string& filename) :
4141
void
4242
TileSetParser::parse(uint32_t start, uint32_t end, int32_t offset)
4343
{
44+
if (offset && (int)start + offset < 1) {
45+
start = -offset + 1;
46+
log_warning << "The defined offset would assign non-positive ids to tiles, tiles below " << -offset + 1 << " will be ignored" << std::endl;
47+
}
48+
4449
m_tiles_path = FileSystem::dirname(m_filename);
4550

4651
auto doc = ReaderDocument::from_file(m_filename);

0 commit comments

Comments
 (0)