git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cherry-pick: do not segfault without arguments.
@ 2013-10-04 14:09 Stefan Beller
  2013-10-10 16:41 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Beller @ 2013-10-04 14:09 UTC (permalink / raw)
  To: hiroshige88, gitster, jrnieder, git; +Cc: Stefan Beller

Commit 182d7dc46b (2013-09-05, cherry-pick: allow "-" as abbreviation of
'@{-1}') accesses the first argument without checking whether it exists.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
---
 builtin/revert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/revert.c b/builtin/revert.c
index 52c35e7..f81a48c 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -202,7 +202,7 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
 	memset(&opts, 0, sizeof(opts));
 	opts.action = REPLAY_PICK;
 	git_config(git_default_config, NULL);
-	if (!strcmp(argv[1], "-"))
+	if (argc > 1 && !strcmp(argv[1], "-"))
 		argv[1] = "@{-1}";
 	parse_args(argc, argv, &opts);
 	res = sequencer_pick_revisions(&opts);
-- 
1.8.4.1.469.gb38b9db

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-10 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-04 14:09 [PATCH] cherry-pick: do not segfault without arguments Stefan Beller
2013-10-10 16:41 ` Jeff King
2013-10-10 21:17   ` Stefan Beller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).