mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
lib/mapObjects/IMarket.cpp: Show error message about failed dynamic_cast() even if cast object is nullptr
This commit is contained in:
parent
bb04ca46b5
commit
703ab677ba
@ -157,8 +157,14 @@ 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 && obj)
|
||||
logGlobal->error("Cannot cast to IMarket object type %s", obj->typeName);
|
||||
if(verbose && !imarket)
|
||||
{
|
||||
logGlobal->error("Cannot cast to IMarket");
|
||||
if(obj)
|
||||
{
|
||||
logGlobal->error("Object type %s", obj->typeName);
|
||||
}
|
||||
}
|
||||
return imarket;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user