Add error checking to 'cmd' buffer as it may not be available (ie. in the case of exec).

llvm-svn: 192318
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
index c23e8e4..232f0c3 100644
--- a/lldb/source/Host/linux/Host.cpp
+++ b/lldb/source/Host/linux/Host.cpp
@@ -403,18 +403,21 @@
     // Get the commond line used to start the process.
     buf_sp = ReadProcPseudoFile(pid, "cmdline");
 
-    // Grab Arg0 first.
+    // Grab Arg0 first, if there is one.
     char *cmd = (char *)buf_sp->GetBytes();
-    process_info.SetArg0(cmd);
-
-    // Now process any remaining arguments.
-    Args &info_args = process_info.GetArguments();
-    char *next_arg = cmd + strlen(cmd) + 1;
-    end_buf = cmd + buf_sp->GetByteSize();
-    while (next_arg < end_buf && 0 != *next_arg)
+    if (cmd)
     {
-        info_args.AppendArgument(next_arg);
-        next_arg += strlen(next_arg) + 1;
+        process_info.SetArg0(cmd);
+
+        // Now process any remaining arguments.
+        Args &info_args = process_info.GetArguments();
+        char *next_arg = cmd + strlen(cmd) + 1;
+        end_buf = cmd + buf_sp->GetByteSize();
+        while (next_arg < end_buf && 0 != *next_arg)
+        {
+            info_args.AppendArgument(next_arg);
+            next_arg += strlen(next_arg) + 1;
+        }
     }
 
     // Read /proc/$PID/stat to get our parent pid.