if(tileAt >= tileset.getMaxTileId()) return null;
if(tileAt >= tilesetMap.size()) return null;
    public Tile getTileAtPoint(int x, int y) {                int twidth = tileset.getTileWidth() + 1;        int theight = tileset.getTileHeight() + 1;        int tilesPerRow = Math.max(1, (getWidth() - 1) / twidth);        //We like Tiled to behave in a predictibile manner; i.e.,        //it should not pick the first tile of the next row if         //there is empty space on the right of the row. Happy now? :P         if(x>tilesPerRow*twidth) x = tilesPerRow*twidth-1;                int tileAt = (y / theight) * tilesPerRow + x/twidth;                if(tileAt >= tileset.getMaxTileId()) return null;                return (Tile) tilesetMap.get(tileAt);    }