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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user