浏览代码

Fixed crashes on loading with Tides of War mod

Ivan Savenko 2 年之前
父节点
当前提交
0a27539fb5
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 1 1
      lib/spells/TargetCondition.cpp
  2. 4 1
      lib/spells/effects/Timed.cpp

+ 1 - 1
lib/spells/TargetCondition.cpp

@@ -541,7 +541,7 @@ void TargetCondition::loadConditions(const JsonNode & source, bool exclusive, bo
 
 			CModHandler::parseIdentifier(keyValue.first, scope, type, identifier);
 
-			item = itemFactory->createConfigurable(scope, type, identifier);
+			item = itemFactory->createConfigurable(keyValue.second.meta, type, identifier);
 		}
 
 		if(item)

+ 4 - 1
lib/spells/effects/Timed.cpp

@@ -250,7 +250,10 @@ void Timed::serializeJsonUnitEffect(JsonSerializeFormat & handler)
 			auto guard = handler.enterStruct(p.first);
 			const JsonNode & bonusNode = handler.getCurrent();
 			auto b = JsonUtils::parseBonus(bonusNode);
-			bonus.push_back(b);
+			if (b)
+				bonus.push_back(b);
+			else
+				logMod->error("Failed to parse bonus '%s'!", p.first);
 		}
 	}
 }