From: Scott Worley Date: Tue, 7 Oct 2025 07:02:28 +0000 (-0700) Subject: Make stop_streams idempotent X-Git-Url: http://git.scottworley.com/srec/commitdiff_plain/4e05cbc803d03f7146ad3b6e9721834513838a8f?ds=sidebyside Make stop_streams idempotent --- 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")