From 74afb317d11ce57ab99cbf8bedbc18edb6c1a05e Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Mon, 16 Sep 2024 19:11:23 -0400 Subject: [PATCH] fixed bug where app panics if anime doesn't exist on Simkl --- SimklFunctions.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SimklFunctions.go b/SimklFunctions.go index 69b14fc..824817a 100644 --- a/SimklFunctions.go +++ b/SimklFunctions.go @@ -268,6 +268,10 @@ func (a *App) SimklSearch(aniListAnime MediaList) SimklAnime { log.Printf("Failed at unmarshal, %s\n", err) } + if len(anime) == 0 { + return result + } + for _, watchListAnime := range SimklWatchList.Anime { id := watchListAnime.Show.Ids.Simkl if id == anime[0].Ids.Simkl { @@ -275,7 +279,7 @@ func (a *App) SimklSearch(aniListAnime MediaList) SimklAnime { } } - if reflect.DeepEqual(result, SimklSearchType{}) && len(anime) > 0 { + if reflect.DeepEqual(result, SimklAnime{}) && len(anime) > 0 { result.Show.Title = anime[0].Title result.Show.Poster = anime[0].Poster result.Show.Ids.Simkl = anime[0].Ids.Simkl