Przeglądaj źródła

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 <engzerjun@gmail.com>
Eng Zer Jun 1 rok temu
rodzic
commit
d23e8925fa
1 zmienionych plików z 1 dodań i 3 usunięć
  1. 1 3
      pkg/dep/dep_graph.go

+ 1 - 3
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) {