From 43ce9e3e7590e65d341edba536a8a36d9faa7e50 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 30 Sep 2009 21:26:51 +0000 Subject: [PATCH] Check for null MDNode element while printing comment. llvm-svn: 83172 --- lib/VMCore/AsmWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;