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>
This commit is contained in:
Eng Zer Jun 2023-12-12 00:45:54 +08:00 committed by GitHub
parent 643830fccd
commit d23e8925fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {