1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

lib/mapObjects/IMarket.cpp: Forming reference to null pointer

Null pointers should not be dereferenced
This commit is contained in:
Alexander Wilms 2023-10-27 19:40:24 +00:00
parent 0a6c82c639
commit 860f6150aa

View File

@ -157,7 +157,7 @@ std::vector<int> IMarket::availableItemsIds(EMarketMode mode) const
const IMarket * IMarket::castFrom(const CGObjectInstance *obj, bool verbose)
{
auto * imarket = dynamic_cast<const IMarket *>(obj);
if(verbose && !imarket)
if(verbose && !imarket && obj)
logGlobal->error("Cannot cast to IMarket object type %s", obj->typeName);
return imarket;
}