[Lldb-commits] [lldb] r284799 - Guard GetEscapedHostname against a nullptr hostname.

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 20 19:32:08 PDT 2016


Author: jmolenda
Date: Thu Oct 20 21:32:08 2016
New Revision: 284799

URL: http://llvm.org/viewvc/llvm-project?rev=284799&view=rev
Log:
Guard GetEscapedHostname against a nullptr hostname.
This can happen if you debug an iOS corefile on
a mac, where PlatformPOSIX::GetHostname ends up
not providing a hostname because we're working 
with a platform of remote-ios.

Modified:
    lldb/trunk/source/Utility/ModuleCache.cpp

Modified: lldb/trunk/source/Utility/ModuleCache.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ModuleCache.cpp?rev=284799&r1=284798&r2=284799&view=diff
==============================================================================
--- lldb/trunk/source/Utility/ModuleCache.cpp (original)
+++ lldb/trunk/source/Utility/ModuleCache.cpp Thu Oct 20 21:32:08 2016
@@ -36,6 +36,8 @@ const char *kSymFileExtension = ".sym";
 const char *kFSIllegalChars = "\\/:*?\"<>|";
 
 std::string GetEscapedHostname(const char *hostname) {
+  if (hostname == nullptr)
+    hostname = "unknown";
   std::string result(hostname);
   size_t size = result.size();
   for (size_t i = 0; i < size; ++i) {




More information about the lldb-commits mailing list