algo/dwindle: don't crash on empty swapsplit (#13533)

ref https://github.com/hyprwm/Hyprland/discussions/13530
This commit is contained in:
Vaxry 2026-03-03 11:55:57 +00:00 committed by GitHub
parent a6e3a2478c
commit 3faddf40d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 36 additions and 26 deletions

View file

@ -84,14 +84,13 @@ static void test13349() {
static void testSplit() {
// Test various split methods
for (auto const& win : {"a", "b"}) {
if (!Tests::spawnKitty(win)) {
NLog::log("{}Failed to spawn kitty with win class `{}`", Colors::RED, win);
++TESTS_FAILED;
ret = 1;
return;
}
}
Tests::spawnKitty("a");
// these must not crash
EXPECT_NOT(getFromSocket("/dispatch layoutmsg swapsplit"), "ok");
EXPECT_NOT(getFromSocket("/dispatch layoutmsg splitratio 1 exact"), "ok");
Tests::spawnKitty("b");
OK(getFromSocket("/dispatch focuswindow class:a"));
OK(getFromSocket("/dispatch layoutmsg splitratio -0.2"));