fixed bug where app panics if anime doesn't exist on Simkl
This commit is contained in:
		@@ -268,6 +268,10 @@ func (a *App) SimklSearch(aniListAnime MediaList) SimklAnime {
 | 
				
			|||||||
			log.Printf("Failed at unmarshal, %s\n", err)
 | 
								log.Printf("Failed at unmarshal, %s\n", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if len(anime) == 0 {
 | 
				
			||||||
 | 
								return result
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for _, watchListAnime := range SimklWatchList.Anime {
 | 
							for _, watchListAnime := range SimklWatchList.Anime {
 | 
				
			||||||
			id := watchListAnime.Show.Ids.Simkl
 | 
								id := watchListAnime.Show.Ids.Simkl
 | 
				
			||||||
			if id == anime[0].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.Title = anime[0].Title
 | 
				
			||||||
			result.Show.Poster = anime[0].Poster
 | 
								result.Show.Poster = anime[0].Poster
 | 
				
			||||||
			result.Show.Ids.Simkl = anime[0].Ids.Simkl
 | 
								result.Show.Ids.Simkl = anime[0].Ids.Simkl
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user