From 032c2cc33320a884a478fd1efd7a03750a6bcca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 7 May 2011 11:23:15 +0200 Subject: [PATCH] Ensure that list is not empty before accessing With settings to animate windows in boxswitch it was possible that an empty list was accessed when the last window closed. BUG: 263306 FIXED-IN: 4.7.0 --- effects/boxswitch/boxswitch.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/effects/boxswitch/boxswitch.cpp b/effects/boxswitch/boxswitch.cpp index 449b3f676c..9875499c39 100644 --- a/effects/boxswitch/boxswitch.cpp +++ b/effects/boxswitch/boxswitch.cpp @@ -547,6 +547,10 @@ void BoxSwitchEffect::calculateItemSizes() qDeleteAll(windows); windows.clear(); if ((mAnimateSwitch && !mProxyActivated) || (mProxyActivated && mProxyAnimateSwitch)) { + if (original_windows.isEmpty()) { + // can happen when last window is closed. + return; + } int index = original_windows.indexOf(effects->currentTabBoxWindow()); int leftIndex = index; int rightIndex = index + 1;