From c6ab01fda2a9318f6761e4c28ada4b96d6394b18 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Fri, 19 Nov 2021 07:43:29 +0100 Subject: [PATCH] Fix panic in get_workspaces_and_windows() --- Cargo.lock | 4 ++-- src/tree.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4388d92..633f083 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -321,9 +321,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e277c495ac6cd1a01a58d0a0c574568b4d1ddf14f59965c6a58b8d96400b54f3" +checksum = "063bf466a64011ac24040a49009724ee60a57da1b437617ceb32e53ad61bfb19" dependencies = [ "itoa", "ryu", diff --git a/src/tree.rs b/src/tree.rs index b4a7e91..70d9613 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -286,7 +286,7 @@ impl<'a> Tree<'a> { for ws in workspaces { v.push(ws); let mut wins = self.sorted_nodes_of_type_1(ws, Type::Window); - if first { + if first && !v.is_empty() { wins.rotate_left(1); first = false; }