diff --git a/internal/protocol/bt/fetcher.go b/internal/protocol/bt/fetcher.go index a090445b..1a45a6f9 100644 --- a/internal/protocol/bt/fetcher.go +++ b/internal/protocol/bt/fetcher.go @@ -295,7 +295,7 @@ func (f *Fetcher) doUpload(fromUpload bool) { continue } - stats := f.torrent.Stats() + stats := f.torrentStats() f.data.SeedBytes = lastData.SeedBytes + stats.BytesWrittenData.Int64() // Check is download complete, if not don't check and stop seeding @@ -332,6 +332,17 @@ func (f *Fetcher) doUpload(fromUpload bool) { } } +// Get torrent stats maybe panic, see https://github.com/anacrolix/torrent/issues/972 +func (f *Fetcher) torrentStats() torrent.TorrentStats { + defer func() { + if r := recover(); r != nil { + // ignore panic + } + }() + + return f.torrent.Stats() +} + func (f *Fetcher) UploadedBytes() int64 { return f.data.SeedBytes } diff --git a/ui/flutter/lib/app/modules/create/views/create_view.dart b/ui/flutter/lib/app/modules/create/views/create_view.dart index ab1c525c..5e1b2959 100644 --- a/ui/flutter/lib/app/modules/create/views/create_view.dart +++ b/ui/flutter/lib/app/modules/create/views/create_view.dart @@ -689,8 +689,8 @@ class CreateView extends GetView { style: ElevatedButton.styleFrom(shape: const StadiumBorder()) .copyWith( - backgroundColor: WidgetStateProperty.all( - Get.theme.colorScheme.surface)), + backgroundColor: MaterialStateProperty.all( + Get.theme.colorScheme.background)), onPressed: () { Get.back(); }, diff --git a/ui/flutter/lib/app/modules/extension/views/extension_view.dart b/ui/flutter/lib/app/modules/extension/views/extension_view.dart index e5aa28a8..0a9dbe4a 100644 --- a/ui/flutter/lib/app/modules/extension/views/extension_view.dart +++ b/ui/flutter/lib/app/modules/extension/views/extension_view.dart @@ -335,8 +335,8 @@ class ExtensionView extends GetView { style: ElevatedButton.styleFrom(shape: const StadiumBorder()) .copyWith( - backgroundColor: WidgetStateProperty.all( - Get.theme.colorScheme.surface)), + backgroundColor: MaterialStateProperty.all( + Get.theme.colorScheme.background)), onPressed: () { Get.back(); }, diff --git a/ui/flutter/lib/app/views/open_in_new.dart b/ui/flutter/lib/app/views/open_in_new.dart index ace99337..a0624f5f 100644 --- a/ui/flutter/lib/app/views/open_in_new.dart +++ b/ui/flutter/lib/app/views/open_in_new.dart @@ -17,7 +17,7 @@ class OpenInNew extends StatelessWidget { launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication); }, style: ElevatedButton.styleFrom( - backgroundColor: Get.theme.colorScheme.surface, + backgroundColor: Get.theme.colorScheme.background, ), child: Row( mainAxisSize: MainAxisSize