Skip to content

Commit 8439296

Browse files
committed
Fixed missing null check in BooleanIsAssignedInIfStmt inspection.
1 parent f0bf2ee commit 8439296

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Rubberduck.Inspections/Concrete/BooleanAssignedInIfElseInspection.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ public void ClearContexts()
4848

4949
public override void ExitIfStmt(VBAParser.IfStmtContext context)
5050
{
51-
if (context.elseIfBlock().Any())
51+
if (context.elseIfBlock() != null && context.elseIfBlock().Any())
52+
{
53+
return;
54+
}
55+
56+
if (context.elseBlock() == null)
5257
{
5358
return;
5459
}
@@ -60,6 +65,7 @@ public override void ExitIfStmt(VBAParser.IfStmtContext context)
6065
}
6166

6267
// make sure the assignments are the opposite
68+
6369
if (!(ParserRuleContextHelper.GetDescendent<VBAParser.BooleanLiteralIdentifierContext>(context.block()).GetText() == Tokens.True ^
6470
ParserRuleContextHelper.GetDescendent<VBAParser.BooleanLiteralIdentifierContext>(context.elseBlock().block()).GetText() == Tokens.True))
6571
{

0 commit comments

Comments
 (0)