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
This commit is contained in:
Sean Callanan 2011-04-09 00:21:04 +00:00
parent f03a3383f9
commit 052aa2c256

View File

@ -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) {