Browse Source

ignore updateTorrents() and quickUpdateTorrent() if fragment is detached

pull/538/head
Twig N 5 years ago
parent
commit
1b8daa6817
  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 @@ -144,6 +144,10 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener
* @param newTorrents The new, updated list of torrents
*/
public void updateTorrents(ArrayList<Torrent> newTorrents, ArrayList<Label> currentLabels) {
if (this.isDetached()) {
return;
}
torrents = newTorrents;
this.currentLabels = currentLabels;
applyAllFilters();
@ -155,6 +159,10 @@ public class TorrentsFragment extends Fragment implements OnLabelPickedListener @@ -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
*/
public void quickUpdateTorrent(Torrent affected, boolean wasRemoved) {
if (this.isDetached()) {
return;
}
// Remove the old torrent object first
Iterator<Torrent> iter = torrents.iterator();
while (iter.hasNext()) {

Loading…
Cancel
Save