From 49ed1602686eec9fcd487f54b0baf60e3d33dfad Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 1 Jul 2024 11:17:44 -0500 Subject: [PATCH] loop: prevent stopping a stopped loop --- src/Loop.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Loop.zig b/src/Loop.zig index ceea70b..b08c64b 100644 --- a/src/Loop.zig +++ b/src/Loop.zig @@ -50,6 +50,8 @@ pub fn Loop(comptime T: type) type { /// stops reading from the tty. pub fn stop(self: *Self) void { + // If we don't have a thread, we have nothing to stop + if (self.thread == null) return; self.should_quit = true; // trigger a read self.vaxis.deviceStatusReport(self.tty.anyWriter()) catch {};