Browse Source

Merge pull request #538 from twig/fix-mimic-labels-2

ignore updateTorrents() and quickUpdateTorrent() if fragment is detached
pull/540/head
Eric Kok 5 years ago committed by GitHub
parent
commit
b9e1885215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java

8
app/src/main/java/org/transdroid/core/gui/TorrentsFragment.java

@ -144,6 +144,10 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
* @param newTorrents The new, updated list of torrents * @param newTorrents The new, updated list of torrents
*/ */
public void updateTorrents(ArrayList<Torrent> newTorrents, ArrayList<Label> currentLabels) { public void updateTorrents(ArrayList<Torrent> newTorrents, ArrayList<Label> currentLabels) {
if (this.isDetached()) {
return;
}
torrents = newTorrents; torrents = newTorrents;
this.currentLabels = currentLabels; this.currentLabels = currentLabels;
applyAllFilters(); applyAllFilters();
@ -155,6 +159,10 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
* @param wasRemoved Whether the affected torrent was indeed removed; otherwise it was updated somehow * @param wasRemoved Whether the affected torrent was indeed removed; otherwise it was updated somehow
*/ */
public void quickUpdateTorrent(Torrent affected, boolean wasRemoved) { public void quickUpdateTorrent(Torrent affected, boolean wasRemoved) {
if (this.isDetached()) {
return;
}
// Remove the old torrent object first // Remove the old torrent object first
Iterator<Torrent> iter = torrents.iterator(); Iterator<Torrent> iter = torrents.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {

Loading…
Cancel
Save