Guard GetEscapedHostname against a nullptr hostname.
authorJason Molenda <jmolenda@apple.com>
Fri, 21 Oct 2016 02:32:08 +0000 (02:32 +0000)
committerJason Molenda <jmolenda@apple.com>
Fri, 21 Oct 2016 02:32:08 +0000 (02:32 +0000)
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.

llvm-svn: 284799

lldb/source/Utility/ModuleCache.cpp

index bf76db9..ed1e766 100644 (file)
@@ -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) {