diff --git a/src/opengl/OpenGLVideo.cpp b/src/opengl/OpenGLVideo.cpp index 8d8e48acc..3d1ad8fb2 100644 --- a/src/opengl/OpenGLVideo.cpp +++ b/src/opengl/OpenGLVideo.cpp @@ -392,7 +392,10 @@ void OpenGLVideo::updateViewport() #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QSizeF surfaceSize = d.ctx->surface()->size(); #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) - surfaceSize *= d.ctx->screen()->devicePixelRatio(); + // When changing monitors (plugging and unplugging), the screen might sometimes be nullptr! + if (d.ctx->screen()) { + surfaceSize *= d.ctx->screen()->devicePixelRatio(); + } #else surfaceSize *= qApp->devicePixelRatio(); //TODO: window()->devicePixelRatio() is the window screen's #endif