mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-26 08:37:29 +00:00
better null check
This commit is contained in:
parent
3f09de05f3
commit
1b6894bf5f
@ -109,6 +109,7 @@ public class FeedService extends BaseService {
|
|||||||
final List<Media> allPosts = new ArrayList<>();
|
final List<Media> allPosts = new ArrayList<>();
|
||||||
final List<Media> items = feedFetchResponse.getItems();
|
final List<Media> items = feedFetchResponse.getItems();
|
||||||
for (final Media media : items) {
|
for (final Media media : items) {
|
||||||
|
if (media == null || media.isInjected() || (media.getMediaType() == null && media.getEndOfFeedDemarcator() == null)) continue;
|
||||||
if (needNewMaxId && media.getEndOfFeedDemarcator() != null) {
|
if (needNewMaxId && media.getEndOfFeedDemarcator() != null) {
|
||||||
final EndOfFeedDemarcator endOfFeedDemarcator = media.getEndOfFeedDemarcator();
|
final EndOfFeedDemarcator endOfFeedDemarcator = media.getEndOfFeedDemarcator();
|
||||||
final EndOfFeedGroupSet groupSet = endOfFeedDemarcator.getGroupSet();
|
final EndOfFeedGroupSet groupSet = endOfFeedDemarcator.getGroupSet();
|
||||||
@ -121,13 +122,12 @@ public class FeedService extends BaseService {
|
|||||||
nextMaxId = group.getNextMaxId();
|
nextMaxId = group.getNextMaxId();
|
||||||
final List<Media> feedItems = group.getFeedItems();
|
final List<Media> feedItems = group.getFeedItems();
|
||||||
for (final Media feedItem : feedItems) {
|
for (final Media feedItem : feedItems) {
|
||||||
if (feedItem == null || feedItem.isInjected()) continue;
|
if (feedItem == null || feedItem.isInjected() || feedItem.getMediaType() == null) continue;
|
||||||
allPosts.add(feedItem);
|
allPosts.add(feedItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (media.isInjected() || media.getMediaType() == null) continue;
|
|
||||||
allPosts.add(media);
|
allPosts.add(media);
|
||||||
}
|
}
|
||||||
return new PostsFetchResponse(allPosts, moreAvailable, nextMaxId);
|
return new PostsFetchResponse(allPosts, moreAvailable, nextMaxId);
|
||||||
|
Loading…
Reference in New Issue
Block a user