From a3fbc5aee51823b92d6329b0d9628422b06ad25c Mon Sep 17 00:00:00 2001 From: PKEuS Date: Fri, 2 Jan 2015 11:24:28 +0100 Subject: [PATCH] Refactorization: Avoid stringification of second branch if first branch was empty in CheckOther::checkDuplicateBranch() --- lib/checkother.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index bee285611..5f4afe031 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2024,11 +2024,14 @@ void CheckOther::checkDuplicateBranch() // save if branch code std::string branch1 = scope->classStart->next()->stringifyList(scope->classEnd); + if (branch1.empty()) + continue; + // save else branch code std::string branch2 = scope->classEnd->tokAt(3)->stringifyList(scope->classEnd->linkAt(2)); // check for duplicates - if (!branch1.empty() && branch1 == branch2) + if (branch1 == branch2) duplicateBranchError(scope->classDef, scope->classEnd->next()); } }