Cocoa: prevent scale factor value of 0.

Check that the NSWindow pointer is valid before
calling backingScaleFactor.

Change-Id: Ia23cbb4058b7d0fece008bc437f8bfec6c0ddebe
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Morten Johan Sørvig 2013-01-04 11:11:49 +01:00 committed by The Qt Project
parent 52a317092e
commit 393fcf69dc

View File

@ -67,7 +67,7 @@ QPaintDevice *QCocoaBackingStore::paintDevice()
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
QCocoaWindow *cocoaWindow = static_cast<QCocoaWindow *>(window()->handle());
if (cocoaWindow && cocoaWindow->m_contentView) {
if (cocoaWindow && cocoaWindow->m_contentView && [cocoaWindow->m_contentView window]) {
scaleFactor = int([[cocoaWindow->m_contentView window] backingScaleFactor]);
}
}