From 9bdc4e1a59a89b35d6625057b4e91fe8b7073756 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Fri, 17 Oct 2014 01:55:08 +0000 Subject: [PATCH] Add null-checks around getter/setter before using them. clang static analyzer fixit. llvm-svn: 220024 --- lldb/source/Symbol/ClangASTType.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp index e35d2af..d8e053d 100644 --- a/lldb/source/Symbol/ClangASTType.cpp +++ b/lldb/source/Symbol/ClangASTType.cpp @@ -5370,9 +5370,12 @@ ClangASTType::AddObjCClassProperty (const char *property_name, if (getter && metadata) ClangASTContext::SetMetadata(m_ast, getter, *metadata); - getter->setMethodParams(*m_ast, llvm::ArrayRef(), llvm::ArrayRef()); + if (getter) + { + getter->setMethodParams(*m_ast, llvm::ArrayRef(), llvm::ArrayRef()); - class_interface_decl->addDecl(getter); + class_interface_decl->addDecl(getter); + } } if (!setter_sel.isNull() && !class_interface_decl->lookupInstanceMethod(setter_sel)) @@ -5417,9 +5420,12 @@ ClangASTType::AddObjCClassProperty (const char *property_name, clang::SC_Auto, nullptr)); - setter->setMethodParams(*m_ast, llvm::ArrayRef(params), llvm::ArrayRef()); + if (setter) + { + setter->setMethodParams(*m_ast, llvm::ArrayRef(params), llvm::ArrayRef()); - class_interface_decl->addDecl(setter); + class_interface_decl->addDecl(setter); + } } return true; -- 2.7.4