From ad1ed132d13077f5eebcc24b122be23a9cb21b6d Mon Sep 17 00:00:00 2001 From: fufesou <13586388+fufesou@users.noreply.github.com> Date: Sat, 9 Aug 2025 15:54:00 +0800 Subject: [PATCH] fix: file transfer, web (#12565) Signed-off-by: fufesou --- flutter/lib/models/file_model.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/flutter/lib/models/file_model.dart b/flutter/lib/models/file_model.dart index fabbcc00c..db9b13e45 100644 --- a/flutter/lib/models/file_model.dart +++ b/flutter/lib/models/file_model.dart @@ -30,15 +30,17 @@ enum SortBy { class JobID { int _count = 0; int next() { - String v = bind.mainGetCommonSync(key: 'transfer-job-id'); try { - return int.parse(v); + if (!isWeb) { + String v = bind.mainGetCommonSync(key: 'transfer-job-id'); + return int.parse(v); + } } catch (e) { - // unreachable. But we still handle it to make it safe. - // If we return -1, we have to check it in the caller. - _count++; - return _count; + debugPrint("Failed to get transfer job id: $e"); } + // Finally increase the count if on the web or if failed to get the id. + _count++; + return _count; } }