From 71dc3dea644e3d0302abbed6657413b633365476 Mon Sep 17 00:00:00 2001 From: Adenilson Cavalcanti Da Silva Date: Sun, 17 Jan 2010 06:05:54 +0000 Subject: [PATCH] Fixing a segfault by -1 in plasma-netbook (special thanks to notmart). svn path=/trunk/KDE/kdelibs/; revision=1075973 --- animations/stackedlayout.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/animations/stackedlayout.cpp b/animations/stackedlayout.cpp index 2f3a0bd0c..cceff89bc 100644 --- a/animations/stackedlayout.cpp +++ b/animations/stackedlayout.cpp @@ -46,7 +46,11 @@ QSizeF StackedLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) con qreal left, top, right, bottom; getContentsMargins(&left, &top, &right, &bottom); - QSizeF currentWidgetSize = itemAt(m_currentWidgetIndex)->effectiveSizeHint(which, constraint); + if (m_currentWidgetIndex <= 0 || !itemAt(m_currentWidgetIndex)) { + return QSizeF(); + } + + QSizeF currentWidgetSize = itemAt(m_currentWidgetIndex)->effectiveSizeHint(which, constraint); return QSizeF( left + right + currentWidgetSize.width(), right + bottom + currentWidgetSize.height()); }