From 176420907b3df2e14deffd7451ccd1764641ecbd Mon Sep 17 00:00:00 2001 From: satoqz Date: Fri, 29 Mar 2024 14:38:27 +0100 Subject: [PATCH] fix segfault in `gh repo rename` --- pkg/cmd/repo/rename/rename.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/repo/rename/rename.go b/pkg/cmd/repo/rename/rename.go index d15f2efdf..df56af951 100644 --- a/pkg/cmd/repo/rename/rename.go +++ b/pkg/cmd/repo/rename/rename.go @@ -135,7 +135,11 @@ func renameRun(opts *RenameOptions) error { remote, err := updateRemote(currRepo, newRepo, opts) if err != nil { - fmt.Fprintf(opts.IO.ErrOut, "%s Warning: unable to update remote %q: %v\n", cs.WarningIcon(), remote.Name, err) + if remote != nil { + fmt.Fprintf(opts.IO.ErrOut, "%s Warning: unable to update remote %q: %v\n", cs.WarningIcon(), remote.Name, err) + } else { + fmt.Fprintf(opts.IO.ErrOut, "%s Warning: unable to update remote: %v\n", cs.WarningIcon(), err) + } } else if opts.IO.IsStdoutTTY() { fmt.Fprintf(opts.IO.Out, "%s Updated the %q remote\n", cs.SuccessIcon(), remote.Name) }