Caught two cases where we were passing a Stream* without checking for NULL
authorEnrico Granata <egranata@apple.com>
Sat, 3 Nov 2012 00:09:46 +0000 (00:09 +0000)
committerEnrico Granata <egranata@apple.com>
Sat, 3 Nov 2012 00:09:46 +0000 (00:09 +0000)
llvm-svn: 167342

lldb/source/Core/ConstString.cpp
lldb/source/Host/common/FileSpec.cpp

index 572b481..7dfc553 100644 (file)
@@ -279,9 +279,12 @@ ConstString::Compare (const ConstString& lhs, const ConstString& rhs)
 void
 ConstString::Dump(Stream *s, const char *fail_value) const
 {
-    const char *cstr = AsCString (fail_value);
-    if (cstr)
-        s->PutCString (cstr);
+    if (s)
+    {
+        const char *cstr = AsCString (fail_value);
+        if (cstr)
+            s->PutCString (cstr);
+    }
 }
 
 void
index d356ff6..5109695 100644 (file)
@@ -524,10 +524,13 @@ FileSpec::Equal (const FileSpec& a, const FileSpec& b, bool full)
 void
 FileSpec::Dump(Stream *s) const
 {
-    m_directory.Dump(s);
-    if (m_directory)
-        s->PutChar('/');
-    m_filename.Dump(s);
+    if (s)
+    {
+        m_directory.Dump(s);
+        if (m_directory)
+            s->PutChar('/');
+        m_filename.Dump(s);
+    }
 }
 
 //------------------------------------------------------------------