Handle NULL strings.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 28 Jan 2010 11:52:39 +0000 (11:52 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 12 Nov 2010 18:47:59 +0000 (18:47 +0000)
log.cpp

diff --git a/log.cpp b/log.cpp
index ca526dd..73bc408 100644 (file)
--- a/log.cpp
+++ b/log.cpp
@@ -325,6 +325,10 @@ void EndReference(void) {
 
 void DumpString(const char *str) {
     const unsigned char *p = (const unsigned char *)str;
+    if (!str) {
+        Log::Text("L\"");
+        return;
+    }
     Log::Text("\"");
     unsigned char c;
     while((c = *p++) != 0) {
@@ -357,6 +361,10 @@ void DumpString(const char *str) {
 
 void DumpWString(const wchar_t *str) {
     const wchar_t *p = str;
+    if (!str) {
+        Log::Text("L\"");
+        return;
+    }
     Log::Text("L\"");
     wchar_t c;
     while((c = *p++) != 0) {