aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2015-06-16 16:00:26 -0700
committerStephen Hines <srhines@google.com>2015-06-16 17:45:03 -0700
commitddaba0fb7804ee40af648cc24f0b9e51c10a05d7 (patch)
treeb532db9dc65cfa819f8317478e93815b3b0bec57
parente23d82b457517d0302ebabefad32118ac7b78023 (diff)
downloadandroid_frameworks_compile_slang-ddaba0fb7804ee40af648cc24f0b9e51c10a05d7.tar.gz
android_frameworks_compile_slang-ddaba0fb7804ee40af648cc24f0b9e51c10a05d7.tar.bz2
android_frameworks_compile_slang-ddaba0fb7804ee40af648cc24f0b9e51c10a05d7.zip
Fix potential nullptr dereference.
Bug: 21597073 We must use dyn_cast_or_null<> instead of dyn_cast<>, because we aren't guaranteed to always be passed a NamedDecl. Change-Id: I7b00eacc639a688f8e2fdbeea80b87a01372e232 (cherry picked from commit 33ea573b6df7b7fe48d2b68d4c479f33082e3c0d)
-rw-r--r--slang_rs_export_type.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/slang_rs_export_type.cpp b/slang_rs_export_type.cpp
index d73f866..d0b6094 100644
--- a/slang_rs_export_type.cpp
+++ b/slang_rs_export_type.cpp
@@ -678,7 +678,7 @@ bool RSExportType::ValidateType(slang::RSContext *Context, clang::ASTContext &C,
// If this is an externally visible variable declaration, we check if the
// type is able to be exported first.
- if (auto VD = llvm::dyn_cast<clang::VarDecl>(ND)) {
+ if (auto VD = llvm::dyn_cast_or_null<clang::VarDecl>(ND)) {
if (VD->getFormalLinkage() == clang::ExternalLinkage) {
if (!TypeExportable(T, Context, VD)) {
return false;