瀏覽代碼

Catch exceptions by const-ref, not by value

Michał Janiszewski 7 年之前
父節點
當前提交
9822a8f2df
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      AI/VCAI/VCAI.cpp
  2. 1 1
      lib/CGeneralTextHandler.cpp

+ 1 - 1
AI/VCAI/VCAI.cpp

@@ -1537,7 +1537,7 @@ void VCAI::wander(HeroPtr h)
 			{
 				decomposeGoal(bestObjectGoal)->accept(this);
 			}
-			catch(goalFulfilledException e)
+			catch(const goalFulfilledException & e)
 			{
 				if(e.goal->goalType == Goals::EGoals::VISIT_TILE || e.goal->goalType == Goals::EGoals::VISIT_OBJ)
 					continue;

+ 1 - 1
lib/CGeneralTextHandler.cpp

@@ -484,7 +484,7 @@ CGeneralTextHandler::CGeneralTextHandler()
 				znpc00.push_back(parser.readString());
 			} while (parser.endLine());
 		}
-		catch (std::runtime_error)
+		catch (const std::runtime_error &)
 		{
 			logGlobal->warn("WoG file ZNPC00.TXT containing commander texts was not found");
 		}