From 009597d0489a61f2dee9a4739865cb0809d2bd2e Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Tue, 6 Jan 2015 23:33:34 +0000 Subject: [PATCH] Fix needed for the new terminal test I previously checked in. It was crashing due to a NULL dereference. llvm-svn: 225316 --- lldb/source/Host/macosx/Host.mm | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm index 338e8fb..269d6f9 100644 --- a/lldb/source/Host/macosx/Host.mm +++ b/lldb/source/Host/macosx/Host.mm @@ -470,24 +470,29 @@ LaunchInNewTerminalWithAppleScript (const char *exe_path, ProcessLaunchInfo &lau // need to be sent to darwin-debug. If we send all environment entries, we might blow the // max command line length, so we only send user modified entries. const char **envp = launch_info.GetEnvironmentEntries().GetConstArgumentVector (); + StringList host_env; const size_t host_env_count = Host::GetEnvironment (host_env); - const char *env_entry; - for (size_t env_idx = 0; (env_entry = envp[env_idx]) != NULL; ++env_idx) + + if (envp && envp[0]) { - bool add_entry = true; - for (size_t i=0; i