Merge pull request #4340 from damoasda/FeedItemlistFragment-NPE-fix
Fix NullPointerException in FeedItemlistFragment when deleting a podcast
This commit is contained in:
commit
5a56fb6f0d
|
@ -358,7 +358,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
if (event.hasChangedFeedUpdateStatus(isUpdatingFeed)) {
|
if (event.hasChangedFeedUpdateStatus(isUpdatingFeed)) {
|
||||||
updateSyncProgressBarVisibility();
|
updateSyncProgressBarVisibility();
|
||||||
}
|
}
|
||||||
if (adapter != null && update.mediaIds.length > 0) {
|
if (adapter != null && update.mediaIds.length > 0 && feed != null) {
|
||||||
for (long mediaId : update.mediaIds) {
|
for (long mediaId : update.mediaIds) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithMediaId(feed.getItems(), mediaId);
|
int pos = FeedItemUtil.indexOfItemWithMediaId(feed.getItems(), mediaId);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
|
@ -398,7 +398,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onFeedListChanged(FeedListUpdateEvent event) {
|
public void onFeedListChanged(FeedListUpdateEvent event) {
|
||||||
if (event.contains(feed)) {
|
if (feed != null && event.contains(feed)) {
|
||||||
updateUi();
|
updateUi();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,9 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
}
|
}
|
||||||
recyclerView.setVisibility(View.VISIBLE);
|
recyclerView.setVisibility(View.VISIBLE);
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
adapter.updateItems(feed.getItems());
|
if (feed != null) {
|
||||||
|
adapter.updateItems(feed.getItems());
|
||||||
|
}
|
||||||
|
|
||||||
getActivity().supportInvalidateOptionsMenu();
|
getActivity().supportInvalidateOptionsMenu();
|
||||||
updateSyncProgressBarVisibility();
|
updateSyncProgressBarVisibility();
|
||||||
|
@ -553,4 +555,4 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
holder.coverHolder.setVisibility(View.GONE);
|
holder.coverHolder.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue