diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 6e75b9aa1bb..92cf8c253e4 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1888,6 +1888,8 @@ void QWindowsWindow::handleDpiChanged(HWND hwnd, WPARAM wParam, LPARAM lParam) // Scale child QPlatformWindow size. Windows sends WM_DPICHANGE to top-level windows only. for (QWindow *childWindow : window()->findChildren()) { QWindowsWindow *platformChildWindow = static_cast(childWindow->handle()); + if (!platformChildWindow) + continue; QRect currentGeometry = platformChildWindow->geometry(); QRect scaledGeometry = QRect(currentGeometry.topLeft() * scale, currentGeometry.size() * scale); platformChildWindow->setGeometry(scaledGeometry);