]> git.ipfire.org Git - thirdparty/git.git/commit
replay: move onto NULL check before first use
authorRené Scharfe <l.s.r@web.de>
Thu, 11 Dec 2025 17:56:54 +0000 (18:56 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Dec 2025 03:41:26 +0000 (12:41 +0900)
commita4a77e41fa0ee3d526993be47086bbfe3a115cdc
tree5927f99cc76a2f94e7e20594b62832691ea88fcb
parent8cb4a114382ea6eed7adade5c0701eae4c6c42d4
replay: move onto NULL check before first use

cmd_replay() aborts if the pointer "onto" is NULL after argument
parsing, e.g. when specifying a non-existing commit with --onto.
15cd4ef1f4 (replay: make atomic ref updates the default behavior,
2025-11-06) added code that dereferences this pointer before the check.
Switch their places to avoid a segmentation fault.

Reported-by: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/replay.c