Fix #14347: Crash when inserting a tile element without room

This commit is contained in:
Michael Steenbeek 2021-03-18 23:28:43 +01:00 committed by GitHub
parent 850e7431c3
commit 2b9a3424b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -218,7 +218,7 @@ TileElement* tile_element_insert(const CoordsXYZ& loc, int32_t occupiedQuadrants
template<typename T> T* TileElementInsert(const CoordsXYZ& loc, int32_t occupiedQuadrants)
{
auto* element = tile_element_insert(loc, occupiedQuadrants, T::ElementType);
return element->template as<T>();
return (element != nullptr) ? element->template as<T>() : nullptr;
}
namespace GameActions