From 4e05cbc803d03f7146ad3b6e9721834513838a8f Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Tue, 7 Oct 2025 00:02:28 -0700 Subject: [PATCH] Make stop_streams idempotent --- srec.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/srec.py b/srec.py index 7ef4d46..c4d5d54 100644 --- a/srec.py +++ b/srec.py @@ -128,15 +128,16 @@ def on_start_button(_: Gtk.Button, stack: Gtk.Stack) -> None: def stop_streams() -> None: global recording, sharing # pylint: disable=global-statement - assert recording is not None - recording.stop() - recording = None + if recording is not None: + recording.stop() + recording = None if sharing is not None: sharing.stop() sharing = None def on_stop_button(_: Gtk.Button, stack: Gtk.Stack) -> None: + assert recording is not None stop_streams() stack.set_visible_child_name("not_recording") -- 2.51.2