diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index fbd62dd0728..34ce7bb9964 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -874,7 +874,7 @@ static void WriteMDNodeComment(const MDNode *Node, formatted_raw_ostream &Out) { if (Node->getNumElements() < 1) return; - ConstantInt *CI = dyn_cast(Node->getElement(0)); + ConstantInt *CI = dyn_cast_or_null(Node->getElement(0)); if (!CI) return; unsigned Val = CI->getZExtValue(); unsigned Tag = Val & ~LLVMDebugVersionMask;