From d23e8925fa6b06df55bfa39bbcb9919247f8db34 Mon Sep 17 00:00:00 2001 From: Eng Zer Jun Date: Tue, 12 Dec 2023 00:45:54 +0800 Subject: [PATCH] fix(dep_graph): fix panic on selecting AUR providers (#2333) This commit fixes https://github.com/Jguer/yay/issues/2289 by making `provideMenu` returns the first option when it receives an error input from the user (e.g. user sends EOF). Signed-off-by: Eng Zer Jun --- pkg/dep/dep_graph.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/dep/dep_graph.go b/pkg/dep/dep_graph.go index 913d257c..616cdf1c 100644 --- a/pkg/dep/dep_graph.go +++ b/pkg/dep/dep_graph.go @@ -749,7 +749,7 @@ func (g *Grapher) provideMenu(dep string, options []aur.Pkg) *aur.Pkg { if err != nil { g.logger.Errorln(err) - break + return &options[0] } if numberBuf == "" { @@ -772,8 +772,6 @@ func (g *Grapher) provideMenu(dep string, options []aur.Pkg) *aur.Pkg { return &options[num-1] } - - return nil } func makeAURPKGFromSrcinfo(dbExecutor db.Executor, srcInfo *gosrc.Srcinfo) ([]*aur.Pkg, error) {