refactor(kilo): address code review suggestions for robustness

This commit is contained in:
DetroitTommy
2026-02-15 17:26:29 -05:00
parent 5a7932cba4
commit d328e54e4b
3 changed files with 33 additions and 18 deletions

View File

@@ -75,8 +75,8 @@ func (a *KiloAuthenticator) Login(ctx context.Context, cfg *config.Config, opts
return nil, err
}
var choice int
fmt.Sscanf(input, "%d", &choice)
if choice > 0 && choice <= len(profile.Orgs) {
_, err = fmt.Sscan(input, &choice)
if err == nil && choice > 0 && choice <= len(profile.Orgs) {
orgID = profile.Orgs[choice-1].ID
} else {
orgID = profile.Orgs[0].ID