Skip to content

Commit

Permalink
fix crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
insomniachi committed Mar 20, 2024
1 parent fb77d34 commit dd86751
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Totoro.Core/Services/MyAnimeList/MyAnimeListService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,15 @@ public async IAsyncEnumerable<int> GetFillers(long id)
var offset = 0;
do
{
response = await _jikan.GetAnimeEpisodesAsync(animeId.MyAnimeList.Value, currentPage++);
try
{
response = await _jikan.GetAnimeEpisodesAsync(animeId.MyAnimeList.Value, currentPage++);
}
catch
{
yield break;
}

foreach (var item in response.Data.Select((x, index) => (x, index)).Where(x => x.x.Filler == true).Select(x => x.index + 1 + offset))
{
yield return item;
Expand Down
3 changes: 2 additions & 1 deletion Totoro.Core/ViewModels/WatchViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ public WatchViewModel(IPluginFactory<AnimeProvider> providerFactory,

this.ObservableForProperty(x => x.Anime, x => x)
.WhereNotNull()
.ObserveOn(RxApp.MainThreadScheduler)
.Do(async model => await UpdateMetaData(model.Id))
.SelectMany(model => Find(model.Id, model.Title))
.Where(x => x is not (null, null))
.Log(this, "Selected Anime", x => $"{x.Sub.Title}")
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(async x =>
{
var hasSubDub = x is { Dub: { }, Sub: { } };
Expand Down Expand Up @@ -621,6 +621,7 @@ private void SetAnime(long id)

_animeService.GetInformation(id)
.ToObservable()
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(async anime =>
{
_anime = anime;
Expand Down

0 comments on commit dd86751

Please sign in to comment.