summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-11-19 10:45:46 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-11-19 10:45:46 (GMT)
commitb0691b5a95c80ecd94867873e912e6952a2ec1b4 (patch)
tree10b015243ba5c9c5323735d4fac83323b290e801 /src/gui/styles
parent7727a0288c1ffb40ecff13e7bfc49ce99b984633 (diff)
downloadQt-b0691b5a95c80ecd94867873e912e6952a2ec1b4.zip
Qt-b0691b5a95c80ecd94867873e912e6952a2ec1b4.tar.gz
Qt-b0691b5a95c80ecd94867873e912e6952a2ec1b4.tar.bz2
QS60Style: Null pointer crash when using itemviews in some cases
QS60Style attempts to use null pointer when drawing CE_ItemViewItem, if the parameter widget is provided as null. This leads to, for example, Chart example app crash in startup. Reviewed-by: Janne Anttila
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/qs60style.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 5fe9050..22cb7d6 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -1438,10 +1438,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &voptAdj, widget);
QRect textRect = subElementRect(SE_ItemViewItemText, &voptAdj, widget);
const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget);
- const bool singleSelection =
- (itemView->selectionMode() == QAbstractItemView::SingleSelection ||
- itemView->selectionMode() == QAbstractItemView::NoSelection);
- const bool selectItems = (itemView->selectionBehavior() == QAbstractItemView::SelectItems);
+
+ const bool singleSelection = itemView &&
+ ((itemView->selectionMode() == QAbstractItemView::SingleSelection ||
+ itemView->selectionMode() == QAbstractItemView::NoSelection));
+ const bool selectItems = itemView && (itemView->selectionBehavior() == QAbstractItemView::SelectItems);
// draw themed background for itemview unless background brush has been defined.
if (vopt->backgroundBrush == Qt::NoBrush) {