From e324a33137a7eeef1f13419eaa217ef60ce3c53d Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Tue, 30 Sep 2025 18:16:35 -0400 Subject: [PATCH] NiriService: added safe guards to avoid issue with wrong window indexes. --- Services/NiriService.qml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Services/NiriService.qml b/Services/NiriService.qml index 2e14747e..ef525bb8 100644 --- a/Services/NiriService.qml +++ b/Services/NiriService.qml @@ -227,7 +227,9 @@ Item { // Only emit activeWindowChanged if the focused window actually changed if (oldFocusedIndex !== focusedWindowIndex) { - windows[oldFocusedIndex].isFocused = false + if (oldFocusedIndex >= 0 && oldFocusedIndex < windows.length) { + windows[oldFocusedIndex].isFocused = false + } activeWindowChanged() } } @@ -282,7 +284,7 @@ Item { if (focusedId) { const newIndex = windows.findIndex(w => w.id === focusedId) - if (newIndex >= 0) { + if (newIndex >= 0 && newIndex < windows.length) { windows[newIndex].isFocused = true }