diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-10 02:36:25 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-12-10 02:36:25 +0000 |
commit | 173e911394923d72d143483fc8e922dcb4180456 (patch) | |
tree | ec0d6540caf515b654138b64220cfff852bc31d3 /clang/tools/libclang/CIndexUSRs.cpp | |
parent | c7f355b8e177393737e99a5a1259f90cdbfd3461 (diff) | |
download | bcm5719-llvm-173e911394923d72d143483fc8e922dcb4180456.tar.gz bcm5719-llvm-173e911394923d72d143483fc8e922dcb4180456.zip |
[libclang] Add defensive checks to make sure we don't try to dereference
a null pointer after getCursorDecl() is called. rdar://10298421.
llvm-svn: 146312
Diffstat (limited to 'clang/tools/libclang/CIndexUSRs.cpp')
-rw-r--r-- | clang/tools/libclang/CIndexUSRs.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndexUSRs.cpp b/clang/tools/libclang/CIndexUSRs.cpp index 32c4db6abec..40d4fb1c694 100644 --- a/clang/tools/libclang/CIndexUSRs.cpp +++ b/clang/tools/libclang/CIndexUSRs.cpp @@ -845,6 +845,9 @@ CXString clang_getCursorUSR(CXCursor C) { if (clang_isDeclaration(K)) { Decl *D = cxcursor::getCursorDecl(C); + if (!D) + return createCXString(""); + CXTranslationUnit TU = cxcursor::getCursorTU(C); if (!TU) return createCXString(""); |