From 7a323d5438b3c26af92031486d5023ede9645d57 Mon Sep 17 00:00:00 2001 From: Luke Aguilar Date: Sat, 24 Aug 2024 10:02:38 +1000 Subject: [PATCH] fixing crashing bug with reset callback after closed (#50) --- lib/stop_watch_timer.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/stop_watch_timer.dart b/lib/stop_watch_timer.dart index 3b853eb..293c479 100644 --- a/lib/stop_watch_timer.dart +++ b/lib/stop_watch_timer.dart @@ -403,8 +403,12 @@ class StopWatchTimer { _currentSessionStartTime = 0; _previousTotalSessionTime = 0; _records = []; - _recordsController.add(_records); - _elapsedTime.add(_presetTime); + if (!_recordsController.isClosed) { + _recordsController.add(_records); + } + if (!_elapsedTime.isClosed) { + _elapsedTime.add(_presetTime); + } } void _lap() {