From: Ingo Ruhnke Date: Tue, 23 Nov 2004 16:49:13 +0000 (+0000) Subject: let the TileManager always return a valid tile in case of error X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9474517395e69ac4962164c58b3d1f8b0c8b88f6;p=supertux.git let the TileManager always return a valid tile in case of error SVN-Revision: 2155 --- diff --git a/src/tile_manager.h b/src/tile_manager.h index 3e9052f67..6c2e8cc13 100644 --- a/src/tile_manager.h +++ b/src/tile_manager.h @@ -70,7 +70,16 @@ class TileManager const Tile* get(uint32_t id) const { assert(id < tiles.size()); - return tiles[id]; + Tile* t = tiles[id]; + if (t) + { + return t; + } + else + { + std::cout << "TileManager: Invalid tile: " << id << std::endl; + return tiles[0]; + } } uint32_t get_max_tileid() const