Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2011-07-25 13:49:00 -0400
committerMarc-Andre Laperle2011-07-25 13:49:00 -0400
commit74ecb38ea31e7ac24a73f060477ade5300f04aa8 (patch)
tree1b6ab3c95ee6edcdff1dde440dd7654fb08ab275 /codan/org.eclipse.cdt.codan.checkers
parent579f5aa0ec4d299d18af50f0af7313aa64b4ecdc (diff)
downloadorg.eclipse.cdt-74ecb38ea31e7ac24a73f060477ade5300f04aa8.tar.gz
org.eclipse.cdt-74ecb38ea31e7ac24a73f060477ade5300f04aa8.tar.xz
org.eclipse.cdt-74ecb38ea31e7ac24a73f060477ade5300f04aa8.zip
Bug 352983 - internal error in switch isFallThroughStatement
Diffstat (limited to 'codan/org.eclipse.cdt.codan.checkers')
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java
index b033eb0e89..a56b94379f 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/CaseBreakChecker.java
@@ -139,7 +139,11 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
if (body == null) return true;
if (body instanceof IASTCompoundStatement) {
IASTStatement[] statements = ((IASTCompoundStatement) body).getStatements();
- return isFallThroughStamement(statements[statements.length - 1]);
+ if (statements.length > 0) {
+ return isFallThroughStamement(statements[statements.length - 1]);
+ }
+
+ return true;
} else if (isBreakOrExitStatement(body)) {
return false;
} else if (body instanceof IASTExpressionStatement) {

Back to the top