Browse Source

Ignore corrupted .def files

Ivan Savenko 2 years ago
parent
commit
858ba22a27
1 changed files with 11 additions and 3 deletions
  1. 11 3
      client/render/CAnimation.cpp

+ 11 - 3
client/render/CAnimation.cpp

@@ -204,11 +204,19 @@ void CAnimation::printError(size_t frame, size_t group, std::string type) const
 
 
 CAnimation::CAnimation(const AnimationPath & Name):
 CAnimation::CAnimation(const AnimationPath & Name):
 	name(boost::starts_with(Name.getName(), "SPRITES") ? Name : Name.addPrefix("SPRITES/")),
 	name(boost::starts_with(Name.getName(), "SPRITES") ? Name : Name.addPrefix("SPRITES/")),
-	preloaded(false),
-	defFile()
+	preloaded(false)
 {
 {
 	if(CResourceHandler::get()->existsResource(name))
 	if(CResourceHandler::get()->existsResource(name))
-		defFile = std::make_shared<CDefFile>(name);
+	{
+		try
+		{
+			defFile = std::make_shared<CDefFile>(name);
+		}
+		catch ( const std::runtime_error & e)
+		{
+			logAnim->error("Def file %s failed to load! Reason: %s", Name.getOriginalName(), e.what());
+		}
+	}
 
 
 	init();
 	init();