1
0
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:
Alexander Wilms 2023-10-27 22:47:56 +00:00
parent bb04ca46b5
commit 703ab677ba

View File

@ -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;
}