2zw - X11 Windowmanager
Files | Log | Commits | Refs | README
Author: erikbackman
Date: 2024-02-21
Subject: check for null
commit a24717457a6ecd5508e1621fb23c08ff15533620
Author: erikbackman <erikbackman@users.noreply.github.com>
Date: Wed Feb 21 21:45:30 2024 +0100
check for null
diff --git a/src/main.zig b/src/main.zig
index 9ce9158..4de2e39 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -193,7 +193,9 @@ fn unmanage(allocator: std.mem.Allocator, node: *L.Node, destroyed: bool) void {
// IMPROVE: There is no way of determining if a window is still alive so we have to make sure we set
// previously_focused to null if we destroy it. Another way is to set an error handler to handle
// BadWindow errors if we ever try to access it.
- if (node.data.w == previously_focused.?.data.w) previously_focused = null;
+ if (previously_focused) |pf| {
+ if (node.data.w == pf.data.w) previously_focused = null;
+ }
_ = C.XSetInputFocus(
display,