diff --git a/lib/Checker/StreamChecker.cpp b/lib/Checker/StreamChecker.cpp
index 1fd72b5ce259c1883d51dbea5ccccb9493a0645a..01b7d83042e08da21ded7af7a622b11873a557c8 100644
--- a/lib/Checker/StreamChecker.cpp
+++ b/lib/Checker/StreamChecker.cpp
@@ -100,7 +100,7 @@ void StreamChecker::FRead(CheckerContext &C, const CallExpr *CE) {
   // Assume CallAndMessageChecker has been run.
   SVal StreamVal = state->getSVal(CE->getArg(3));
 
-  if (const DefinedSVal *DV = cast<DefinedSVal>(&StreamVal)) {
+  if (const DefinedSVal *DV = dyn_cast<DefinedSVal>(&StreamVal)) {
     ConstraintManager &CM = C.getConstraintManager();
     const GRState *stateNotNull, *stateNull;
     llvm::tie(stateNotNull, stateNull) = CM.AssumeDual(state, *DV);