From 06f0e097568b647a31338861f3a8adcbb021c4d4 Mon Sep 17 00:00:00 2001 From: John McCall Date: Fri, 7 May 2010 21:01:17 +0000 Subject: [PATCH] Fix a potential null dereference in the pointer-to-bool evaluator; caught by Eli Friedman. llvm-svn: 103297 --- clang/lib/AST/ExprConstant.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index b6613e7cdc36..c534d03a5ed8 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -115,7 +115,7 @@ static bool EvalPointerValueAsBool(LValue& Value, bool& Result) { Result = Base || !Value.Offset.isZero(); - const DeclRefExpr* DeclRef = dyn_cast(Base); + const DeclRefExpr* DeclRef = dyn_cast_or_null(Base); if (!DeclRef) return true;