misc fixes

* add null checks before resuming a download
* (MissionAdapter.java) reset percent after resuming a download. prevents the "Error" string get stuck, until the download start
This commit is contained in:
kapodamy 2019-01-15 14:58:56 -03:00
parent df4dd0122f
commit c4a5e8dc86
2 changed files with 4 additions and 2 deletions

View file

@ -407,7 +407,8 @@ public class DownloadMission extends Mission {
// ensure that the previous state is completely paused.
joinForThread(init);
for (Thread thread : threads) joinForThread(thread);
if (threads != null)
for (Thread thread : threads) joinForThread(thread);
enqueued = false;
running = true;
@ -420,7 +421,7 @@ public class DownloadMission extends Mission {
init = null;
if (threads.length < 1) {
if (threads == null || threads.length < 1) {
threads = new Thread[currentThreadCount];
}

View file

@ -447,6 +447,7 @@ public class MissionAdapter extends Adapter<ViewHolder> {
if (mission != null) {
switch (id) {
case R.id.start:
h.status.setText(UNDEFINED_SPEED);
h.state = -1;
h.size.setText(Utility.formatBytes(mission.getLength()));
mDownloadManager.resumeMission(mission);