Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
fix fetch update ui crash
Browse files Browse the repository at this point in the history
  • Loading branch information
befora committed Jul 13, 2018
1 parent 99b3a6c commit eeabcc2
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ open class DownloadsFragmentImpl1_Content : DownloadsFragmentImpl0_View() {
}

private fun updatePosition(download: Download) {
val dataFilteredByUrl = downloadsAdapter.data.filter { it.server + it.linkAcquisition == download.url }
when (dataFilteredByUrl.isEmpty()) {
true -> downloadsAdapter.data.filter { it.getXmlId() == download.group }.forEach { downloadsAdapter.updatePosition(it, download) }
false -> dataFilteredByUrl.forEach { downloadsAdapter.updatePosition(it, download) }
if (::downloadsAdapter.isInitialized) {
downloadsAdapter.apply {
val dataFilteredByUrl = data.filter { it.server + it.linkAcquisition == download.url }
when (dataFilteredByUrl.isEmpty()) {
true -> data.filter { it.getXmlId() == download.group }.forEach { updatePosition(it, download) }
false -> dataFilteredByUrl.forEach { updatePosition(it, download) }
}
}
}
}
}
Expand Down

0 comments on commit eeabcc2

Please sign in to comment.