Avoid a null pointer deref when openGL windows are present

m_context2d in QWasmWindow might be null if the window uses OpenGL
for rendering. It is dereferenced nevertheless in ::paint(), which
should be avoided.

Change-Id: Id817f3663bb475d55dfc916b4b7eb255a88cea9d
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Mikolaj Boc 2022-11-28 14:27:47 +01:00
parent 5d41ec46e9
commit 9bc74d14f3

View File

@ -294,7 +294,7 @@ QWasmScreen *QWasmWindow::platformScreen() const
void QWasmWindow::paint()
{
if (!m_backingStore || !isVisible())
if (!m_backingStore || !isVisible() || m_context2d.isUndefined())
return;
auto image = m_backingStore->getUpdatedWebImage(this);