src/gui/kernel/qdesktopwidget.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
--- a/src/gui/kernel/qdesktopwidget.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/kernel/qdesktopwidget.cpp	Fri Apr 16 15:50:13 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -47,6 +47,11 @@
 
 const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const
 {
+    if (!widget) {
+        qWarning("QDesktopWidget::screenGeometry(): Attempt "
+                 "to get the screen geometry of a null widget");
+        return QRect();
+    }
     QRect rect = QWidgetPrivate::screenGeometry(widget);
     if (rect.isNull())
         return screenGeometry(screenNumber(widget));
@@ -55,6 +60,11 @@
 
 const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const
 {
+    if (!widget) {
+        qWarning("QDesktopWidget::availableGeometry(): Attempt "
+                 "to get the available geometry of a null widget");
+        return QRect();
+    }
     QRect rect = QWidgetPrivate::screenGeometry(widget);
     if (rect.isNull())
         return availableGeometry(screenNumber(widget));