From e8538c22bc581dafd3b8710a024530bd0c01856f Mon Sep 17 00:00:00 2001 From: comp500 Date: Mon, 23 Dec 2019 00:36:54 +0000 Subject: [PATCH] Fix exception when old file doesn't exist --- .../kotlin/link/infra/packwiz/installer/DownloadTask.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/link/infra/packwiz/installer/DownloadTask.kt b/src/main/kotlin/link/infra/packwiz/installer/DownloadTask.kt index 40cc190..ac7c0e2 100644 --- a/src/main/kotlin/link/infra/packwiz/installer/DownloadTask.kt +++ b/src/main/kotlin/link/infra/packwiz/installer/DownloadTask.kt @@ -188,7 +188,12 @@ internal class DownloadTask private constructor(val metadata: IndexFile.File, de cachedFile?.cachedLocation?.let { if (destPath != Paths.get(packFolder, it)) { // Delete old file if location changes - Files.delete(Paths.get(packFolder, cachedFile!!.cachedLocation)) + try { + Files.delete(Paths.get(packFolder, cachedFile!!.cachedLocation)) + } catch (e: IOException) { + // Continue, as it was probably already deleted? + // TODO: log it + } } } } catch (e: Exception) {