1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Fix for #1673 — objects vector may contain nullptr (for objects that have been removed).

This commit is contained in:
Michał W. Urbańczyk
2014-02-01 12:54:55 +00:00
parent d4fd361d4b
commit 6f8974bab3

View File

@@ -321,7 +321,7 @@ const CGObjectInstance * CMap::getObjectiveObjectFrom(int3 pos, Obj::EObj type)
CGObjectInstance * bestMatch = nullptr; CGObjectInstance * bestMatch = nullptr;
for (CGObjectInstance * object : objects) for (CGObjectInstance * object : objects)
{ {
if (object->ID == type) if (object && object->ID == type)
{ {
if (bestMatch == nullptr) if (bestMatch == nullptr)
bestMatch = object; bestMatch = object;