aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2011-04-09 00:21:04 +0000
committerSean Callanan <scallanan@apple.com>2011-04-09 00:21:04 +0000
commit052aa2c256acebab662b6099b155057d4092c3cf (patch)
tree6064f004ff390aef027ebd948564ea83066c3736
parentf03a3383f99b2123ba01dbc138a816c0f733950e (diff)
Moved an access to an object past a NULL check,
making the MC disassembler tester more robust. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129175 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/llvm-mc/Disassembler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/llvm-mc/Disassembler.cpp b/tools/llvm-mc/Disassembler.cpp
index 41b92a1b30..cdd1892f25 100644
--- a/tools/llvm-mc/Disassembler.cpp
+++ b/tools/llvm-mc/Disassembler.cpp
@@ -240,12 +240,12 @@ int Disassembler::disassembleEnhanced(const std::string &TS,
OwningPtr<EDInst>
inst(disassembler->createInst(byteArrayReader, 0, &ByteArray));
- ByteArray.erase (ByteArray.begin(), ByteArray.begin() + inst->byteSize());
-
if (inst == 0) {
errs() << "error: Didn't get an instruction\n";
return -1;
}
+
+ ByteArray.erase (ByteArray.begin(), ByteArray.begin() + inst->byteSize());
unsigned numTokens = inst->numTokens();
if ((int)numTokens < 0) {