https://github.com/charles-zablit created 
https://github.com/llvm/llvm-project/pull/200822

`process_sp` should be null checked before calling the `HijackProcessEvents` 
method. This patch also removes 2 unused variables.

>From 407e67cc193493a85488c00912585b55d0acdddc Mon Sep 17 00:00:00 2001
From: Charles Zablit <[email protected]>
Date: Mon, 1 Jun 2026 14:49:06 +0100
Subject: [PATCH] [lldb][windows] fix late null check

---
 lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index eecbe53d46c24..94e4dd0f40bf5 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -513,13 +513,13 @@ ProcessSP PlatformWindows::DebugProcess(ProcessLaunchInfo 
&launch_info,
   ProcessSP process_sp =
       target.CreateProcess(launch_info.GetListener(),
                            launch_info.GetProcessPluginName(), nullptr, false);
+  if (!process_sp)
+    return nullptr;
 
   process_sp->HijackProcessEvents(launch_info.GetHijackListener());
 
   // We need to launch and attach to the process.
   launch_info.GetFlags().Set(eLaunchFlagDebug);
-  if (!process_sp)
-    return nullptr;
   error = process_sp->Launch(launch_info);
 #ifdef _WIN32
   if (error.Success()) {
@@ -551,9 +551,6 @@ lldb::ProcessSP PlatformWindows::Attach(ProcessAttachInfo 
&attach_info,
 
   if (target == nullptr) {
     TargetSP new_target_sp;
-    FileSpec emptyFileSpec;
-    ArchSpec emptyArchSpec;
-
     error = debugger.GetTargetList().CreateTarget(
         debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp);
     target = new_target_sp.get();

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to