Browse Source

Fixed CID 1288864

AlexVinS 9 years ago
parent
commit
4b2bbd0d76
1 changed files with 6 additions and 4 deletions
  1. 6 4
      server/CGameHandler.cpp

+ 6 - 4
server/CGameHandler.cpp

@@ -5274,12 +5274,14 @@ bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * h
 	ArtifactLocation al(hero, slot);
 	const CArtifactInstance *a = al.getArt();
 
-	if (!a)
-		COMPLAIN_RET("Cannot find artifact to sacrifice!");
-
+	COMPLAIN_RET_FALSE_IF(!a,"Cannot find artifact to sacrifice!");
 
 	int dmp, expToGive;
-	m->getOffer(hero->getArtTypeId(slot), 0, dmp, expToGive, EMarketMode::ARTIFACT_EXP);
+	auto typId = hero->getArtTypeId(slot);
+
+	COMPLAIN_RET_FALSE_IF(typId<0, "No artifact at position!");
+
+	m->getOffer(typId, 0, dmp, expToGive, EMarketMode::ARTIFACT_EXP);
 
 	removeArtifact(al);
 	changePrimSkill(hero, PrimarySkill::EXPERIENCE, expToGive);