From: David Majnemer Date: Thu, 11 Sep 2014 23:42:10 +0000 (+0000) Subject: Object: Small cleanup in COFFObjectFile::getSymbol X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=ddf2ec4d4b3b67339769e910192272c974b65f0b;p=oota-llvm.git Object: Small cleanup in COFFObjectFile::getSymbol NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217648 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Object/COFF.h b/include/llvm/Object/COFF.h index ae79f8b608d..87e8cc2dfab 100644 --- a/include/llvm/Object/COFF.h +++ b/include/llvm/Object/COFF.h @@ -569,10 +569,10 @@ public: template std::error_code getSymbol(uint32_t Index, const coff_symbol_type *&Res) const { - if (Index < getNumberOfSymbols()) - Res = reinterpret_cast(getSymbolTable()) + Index; - else + if (Index >= getNumberOfSymbols()) return object_error::parse_failed; + + Res = reinterpret_cast(getSymbolTable()) + Index; return object_error::success; } ErrorOr getSymbol(uint32_t index) const {