Browse Source

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

Null pointers should not be dereferenced
Alexander Wilms 2 years ago
parent
commit
860f6150aa
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/mapObjects/IMarket.cpp

+ 1 - 1
lib/mapObjects/IMarket.cpp

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