Skip to content

Commit

Permalink
Merge pull request #297 from wata727/fix_panic_is_null_expr
Browse files Browse the repository at this point in the history
Fix panic when checking whether an expression is null
  • Loading branch information
wata727 committed May 29, 2019
2 parents 032d126 + b1b4c89 commit d7a28a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tflint/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,13 @@ func (r *Runner) EnsureNoError(err error, proc func() error) error {

// IsNullExpr check the passed expression is null
func (r *Runner) IsNullExpr(expr hcl.Expression) bool {
val, _ := r.ctx.EvaluateExpr(expr, cty.DynamicPseudoType, nil)
if !isEvaluable(expr) {
return false
}
val, diags := r.ctx.EvaluateExpr(expr, cty.DynamicPseudoType, nil)
if diags.HasErrors() {
return false
}
return val.IsNull()
}

Expand Down

0 comments on commit d7a28a8

Please sign in to comment.