From 8974d2f52c68352446a417e922590237c618ef9f Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Tue, 3 Mar 2026 14:51:36 +0300 Subject: Fix: remove panics from code --- helpfuncs.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'helpfuncs.go') 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 { -- cgit v1.2.3