From 49416992e2ac84f2f8bc28661f056d8bbedeaf77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Thu, 7 Jun 2012 14:14:35 +0200 Subject: [PATCH] sanitize preview generation starting row REVIEW: 105170 --- kcmkwin/kwindecoration/kwindecoration.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kcmkwin/kwindecoration/kwindecoration.cpp b/kcmkwin/kwindecoration/kwindecoration.cpp index 2185d15f99..642e546d06 100644 --- a/kcmkwin/kwindecoration/kwindecoration.cpp +++ b/kcmkwin/kwindecoration/kwindecoration.cpp @@ -377,7 +377,10 @@ void KWinDecorationModule::updatePreviews() const int h = m_ui->decorationList->rootObject()->property("contentHeight").toInt(); const int y = m_ui->decorationList->rootObject()->property("contentY").toInt(); // start at first element in sight - m_model->regeneratePreviews(y*m_model->rowCount()/h); + int row = 0; + if (h > 0) + row = qMin(qMax(0, y*m_model->rowCount()/h), m_model->rowCount()); + m_model->regeneratePreviews(row); } void KWinDecorationModule::updatePreviewWidth()