Explorar el Código

Fix two more potential crashes

Ivan Savenko hace 1 mes
padre
commit
2e4657e718
Se han modificado 2 ficheros con 7 adiciones y 1 borrados
  1. 2 0
      launcher/settingsView/csettingsview_moc.cpp
  2. 5 1
      lib/mapObjects/MiscObjects.cpp

+ 2 - 0
launcher/settingsView/csettingsview_moc.cpp

@@ -156,10 +156,12 @@ void CSettingsView::fillValidAnyAILibraries(QComboBox * comboBox, QString active
 
 	int indexToSelect = comboBox->findData(activeAI);
 
+	comboBox->blockSignals(true);
 	if (indexToSelect == -1)
 		comboBox->setCurrentIndex(0);
 	else
 		comboBox->setCurrentIndex(indexToSelect);
+	comboBox->blockSignals(false);
 }
 
 void CSettingsView::fillValidAILibraries()

+ 5 - 1
lib/mapObjects/MiscObjects.cpp

@@ -687,7 +687,11 @@ void CGArtifact::initObj(IGameRandomizer & gameRandomizer)
 
 std::string CGArtifact::getObjectName() const
 {
-	return getArtifactType().toEntity(LIBRARY)->getNameTranslated();
+	if(ID == Obj::SPELL_SCROLL || ID == Obj::ARTIFACT)
+		return getArtifactType().toEntity(LIBRARY)->getNameTranslated();
+
+	// random artifact
+	return CGObjectInstance::getObjectName();
 }
 
 std::string CGArtifact::getPopupText(PlayerColor player) const