let the TileManager always return a valid tile in case of error
authorIngo Ruhnke <grumbel@gmx.de>
Tue, 23 Nov 2004 16:49:13 +0000 (16:49 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Tue, 23 Nov 2004 16:49:13 +0000 (16:49 +0000)
SVN-Revision: 2155

src/tile_manager.h

index 3e9052f..6c2e8cc 100644 (file)
@@ -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