[llvm-objdump] Don't crash when using `-a` on non-archives
authorJames Henderson <jh7370@my.bristol.ac.uk>
Mon, 29 Oct 2018 14:17:08 +0000 (14:17 +0000)
committerJames Henderson <jh7370@my.bristol.ac.uk>
Mon, 29 Oct 2018 14:17:08 +0000 (14:17 +0000)
commitc1608c96f6cc87c067e009abff42800ed54451a5
tree727ca182eae2c4684ebcf49c5499029316f13db2
parent31f48c50cdb63be7279b8343f1bbf7ef85496336
[llvm-objdump] Don't crash when using `-a` on non-archives

This fixes PR39402. The crash was caused when dereferencing nullptr in
DumpObject and printArchiveChild.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D53690

Patch by Xing GUO

llvm-svn: 345503
llvm/test/tools/llvm-objdump/non-archive-object.test [new file with mode: 0644]
llvm/tools/llvm-objdump/llvm-objdump.cpp