mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
Fix hasNullCase
This commit is contained in:
@@ -1547,7 +1547,10 @@ class SwitchExpr extends Expr, StmtParent, @switchexpr {
|
||||
}
|
||||
|
||||
/** Holds if this switch has a case handling a null literal. */
|
||||
predicate hasNullCase() { this.getAConstCase().getValue(_) instanceof NullLiteral }
|
||||
predicate hasNullCase() {
|
||||
this.getAConstCase().getValue(_) instanceof NullLiteral or
|
||||
this.getACase() instanceof NullDefaultCase
|
||||
}
|
||||
|
||||
/** Gets a printable representation of this expression. */
|
||||
override string toString() { result = "switch (...)" }
|
||||
|
||||
@@ -413,7 +413,10 @@ class SwitchStmt extends Stmt, @switchstmt {
|
||||
Expr getExpr() { result.getParent() = this }
|
||||
|
||||
/** Holds if this switch has a case handling a null literal. */
|
||||
predicate hasNullCase() { this.getAConstCase().getValue(_) instanceof NullLiteral }
|
||||
predicate hasNullCase() {
|
||||
this.getAConstCase().getValue(_) instanceof NullLiteral or
|
||||
this.getACase() instanceof NullDefaultCase
|
||||
}
|
||||
|
||||
override string pp() { result = "switch (...)" }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user