From 954c80e99db5974ef876fca5fd0df0d4b569ab0f Mon Sep 17 00:00:00 2001 From: Victor Hernandez Date: Fri, 4 Dec 2009 18:29:23 +0000 Subject: [PATCH] Fix crasher when N->getElement(n) is NULL git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90572 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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 1865402a65f..44095ca4e85 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -698,7 +698,7 @@ void SlotTracker::processFunction() { if (MDNode *N = dyn_cast_or_null(I->getOperand(i))) { // Create a metadata slot only if N contains no instructions. for (unsigned n = 0, e = N->getNumElements(); n != e; ++n) - if (isa(N->getElement(n))) + if (N->getElement(n) && isa(N->getElement(n))) continue; CreateMetadataSlot(N); }