Unbreak buildbots where the debug info test was crashing due to unchecked error.

llvm-svn: 289017
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
index ea796b4..47709ff 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -51,14 +51,15 @@
 /// \returns true if there were errors, false otherwise.
 template <typename T>
 static bool HandleExpectedError(T &Expected) {
-  if (!Expected)
-    return false;
   std::string ErrorMsg;
   handleAllErrors(Expected.takeError(), [&](const llvm::ErrorInfoBase &EI) {
     ErrorMsg = EI.message();
   });
-  ::testing::AssertionFailure() << "error: " << ErrorMsg;
-  return true;
+  if (!ErrorMsg.empty()) {
+    ::testing::AssertionFailure() << "error: " << ErrorMsg;
+    return true;
+  }
+  return false;
 }
 
 template <uint16_t Version, class AddrType, class RefAddrType>