From 2c27d818de8a63f7263ed4c267270226473a6f0b Mon Sep 17 00:00:00 2001 From: Tianhua Ran Date: Wed, 4 Dec 2019 20:10:51 +0800 Subject: [PATCH] fix: single connection cannot start download without supporting seek Closes #1200 --- .../com/liulishuo/filedownloader/download/FetchDataTask.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/liulishuo/filedownloader/download/FetchDataTask.java b/library/src/main/java/com/liulishuo/filedownloader/download/FetchDataTask.java index 2e69cf3f..69531d16 100644 --- a/library/src/main/java/com/liulishuo/filedownloader/download/FetchDataTask.java +++ b/library/src/main/java/com/liulishuo/filedownloader/download/FetchDataTask.java @@ -116,7 +116,8 @@ public void run() throws IOException, IllegalAccessException, IllegalArgumentExc try { final boolean isSupportSeek = CustomComponentHolder.getImpl().isSupportSeek(); - if (hostRunnable != null && !isSupportSeek) { + final boolean isMultiConnection = connectionIndex >= 0; + if (isMultiConnection && !isSupportSeek) { throw new IllegalAccessException( "can't using multi-download when the output stream can't support seek"); }