summaryrefslogtreecommitdiff
path: root/helpfuncs.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-03-03 14:51:36 +0300
committerGrail Finder <wohilas@gmail.com>2026-03-03 14:51:36 +0300
commit8974d2f52c68352446a417e922590237c618ef9f (patch)
tree48ca436c213bb0b541c37387e657abe313ebcb7e /helpfuncs.go
parent6b0d03f2d632597a75e63d03a9932d189d354a2b (diff)
Fix: remove panics from code
Diffstat (limited to 'helpfuncs.go')
-rw-r--r--helpfuncs.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/helpfuncs.go b/helpfuncs.go
index dab6b61..3132c9d 100644
--- a/helpfuncs.go
+++ b/helpfuncs.go
@@ -291,7 +291,7 @@ func listRolesWithUser() []string {
return result
}
-func loadImage() {
+func loadImage() error {
filepath := defaultImage
cc := GetCardByRole(cfg.AssistantRole)
if cc != nil {
@@ -301,14 +301,15 @@ func loadImage() {
}
file, err := os.Open(filepath)
if err != nil {
- panic(err)
+ return fmt.Errorf("failed to open image: %w", err)
}
defer file.Close()
img, _, err := image.Decode(file)
if err != nil {
- panic(err)
+ return fmt.Errorf("failed to decode image: %w", err)
}
imgView.SetImage(img)
+ return nil
}
func strInSlice(s string, sl []string) bool {