mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
lib/mapObjects/IMarket.cpp: Forming reference to null pointer
Null pointers should not be dereferenced
This commit is contained in:
parent
0a6c82c639
commit
860f6150aa
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user