aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp b/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
index 69e8fbb7ab..207d65ad8f 100644
--- a/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp
@@ -40,7 +40,6 @@ class ObjCContainersChecker : public Checker< check::PreStmt<CallExpr>,
inline SymbolRef getArraySym(const Expr *E, CheckerContext &C) const {
SVal ArrayRef = C.getState()->getSVal(E, C.getLocationContext());
SymbolRef ArraySym = ArrayRef.getAsSymbol();
- assert(ArraySym);
return ArraySym;
}
@@ -120,8 +119,12 @@ void ObjCContainersChecker::checkPreStmt(const CallExpr *CE,
// Retrieve the size.
// Find out if we saw this array symbol before and have information about it.
const Expr *ArrayExpr = CE->getArg(0);
- const DefinedSVal *Size =
- State->get<ArraySizeMap>(getArraySym(ArrayExpr, C));
+ SymbolRef ArraySym = getArraySym(ArrayExpr, C);
+ if (!ArraySym)
+ return;
+
+ const DefinedSVal *Size = State->get<ArraySizeMap>(ArraySym);
+
if (!Size)
return;