Fix nullptr in with_command_1

Message ID CAF4+tmqL0NH6mPufUF0y7+-+7=_OC7FXhDOHE+fVC6=RiFa=RQ@mail.gmail.com
State New, archived
Headers

Commit Message

Bogdan Harjoc Aug. 2, 2019, 12:54 p.m. UTC
  Reproduced with gdb built from git HEAD, running 'with' without
arguments. Patch is attached.

Regards,
Bogdan
  

Comments

Tom Tromey Aug. 2, 2019, 6:04 p.m. UTC | #1
>>>>> "Bogdan" == Bogdan Harjoc <harjoc@gmail.com> writes:

Bogdan> Reproduced with gdb built from git HEAD, running 'with' without
Bogdan> arguments. Patch is attached.

This needs a ChangeLog entry.
I think a simple test case would also be good.

thanks,
Tom
  

Patch

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 0b62622e88..eb8bb6fc76 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -217,6 +217,9 @@  void
 with_command_1 (const char *set_cmd_prefix,
 		cmd_list_element *setlist, const char *args, int from_tty)
 {
+  if (args == nullptr)
+    error (_("Missing arguments."));
+
   const char *delim = strstr (args, "--");
   const char *nested_cmd = nullptr;