X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsector.cpp;h=3d75b7723c32557e5ffad6bbe1ab2c9dd93f1f40;hb=3369ed08e4b7126af560dc5f9c3442fc76b43ab4;hp=434582b0c54973846b5aa22363c8bef6984ee270;hpb=aea1b715f22599f5e202693cb93a0852704d6422;p=supertux.git diff --git a/src/sector.cpp b/src/sector.cpp index 434582b0c..3d75b7723 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -618,6 +618,13 @@ bool Sector::trybreakbrick(const Vector& pos, bool small) { Tile* tile = solids->get_tile_at(pos); + if (!tile) + { + char errmsg[64]; + sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32)); + throw SuperTuxException(errmsg, __FILE__, __LINE__); + } + if (tile->attributes & Tile::BRICK) { if (tile->data > 0) @@ -674,6 +681,14 @@ void Sector::tryemptybox(const Vector& pos, Direction col_side) { Tile* tile = solids->get_tile_at(pos); + if (!tile) + { + char errmsg[64]; + sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32)); + throw SuperTuxException(errmsg, __FILE__, __LINE__); + } + + if (!(tile->attributes & Tile::FULLBOX)) return; @@ -730,6 +745,14 @@ void Sector::trygrabdistro(const Vector& pos, int bounciness) { Tile* tile = solids->get_tile_at(pos); + if (!tile) + { + char errmsg[64]; + sprintf(errmsg, "Invalid tile at %i,%i", (int)((pos.x+1)/32*32), (int)((pos.y+1)/32*32)); + throw SuperTuxException(errmsg, __FILE__, __LINE__); + } + + if (!(tile->attributes & Tile::COIN)) return;