Skip to content

Commit

Permalink
Fix null check in fetchChapters/fetchManga
Browse files Browse the repository at this point in the history
Accounts for deleted chapters/manga from i.e history
  • Loading branch information
r52 committed Jul 15, 2023
1 parent 38e39b3 commit bd719b4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/mangadex/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,10 @@ class MangaDexModel {
}

// Craft the list
for (var id in uuids) {
// Assume that all elements are cache satisfied at this point
list.add(_cache.get<Chapter>(id));
for (final id in uuids) {
if (_cache.exists(id)) {
list.add(_cache.get<Chapter>(id));
}
}

return list;
Expand Down Expand Up @@ -562,8 +563,9 @@ class MangaDexModel {

// Craft the list
for (final id in ids) {
// Assume that all elements are cache satisfied at this point
list.add(_cache.get<Manga>(id));
if (_cache.exists(id)) {
list.add(_cache.get<Manga>(id));
}
}
} else if (filterId != null) {
queryParams['offset'] = offset.toString();
Expand Down

0 comments on commit bd719b4

Please sign in to comment.