[pushed] Add explicit check for nullptr to target_announce_attach

Message ID 20220108164742.3931750-1-tom@tromey.com
State New
Headers show
Series
  • [pushed] Add explicit check for nullptr to target_announce_attach
Related show

Commit Message

Tom Tromey Jan. 8, 2022, 4:47 p.m.
Lancelot pointed out that target_announce_attach was missing an
explicit check against nullptr.  This patch adds it.
---
 gdb/target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.31.1

Patch

diff --git a/gdb/target.c b/gdb/target.c
index c25ce692538..950f2f08e31 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3648,7 +3648,7 @@  target_announce_attach (int from_tty, int pid)
 
   const char *exec_file = get_exec_file (0);
 
-  if (exec_file)
+  if (exec_file != nullptr)
     printf_unfiltered ("Attaching to program: %s, %s\n", exec_file,
 		       target_pid_to_str (ptid_t (pid)).c_str ());
   else