diff options
| author | Mikolaj Boc <mikolaj.boc@qt.io> | 2022-09-12 10:43:07 +0200 |
|---|---|---|
| committer | Mikolaj Boc <mikolaj.boc@qt.io> | 2022-09-12 20:09:03 +0200 |
| commit | 91d7dcea1123d32807ba56269004bcd3c9afa202 (patch) | |
| tree | 5369b6444273e5bef96dff28d73a80fd7eab430c /src/plugins/platforms/wasm/qwasmwindowstack.cpp | |
| parent | 0c1368c7e407d2a7f7814b703c6e6de6a40efa8b (diff) | |
Fix QWasmWindowStack::topWindow when the stack is empty
The method should by contract return nullptr when the stack is empty,
but it crashes in this case.
Also, unit-test the case.
Pick-to: 6.4
Change-Id: If64b71e761efd9a5cd5af407cd68cba7f8dbc8e2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmwindowstack.cpp')
| -rw-r--r-- | src/plugins/platforms/wasm/qwasmwindowstack.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/wasm/qwasmwindowstack.cpp b/src/plugins/platforms/wasm/qwasmwindowstack.cpp index cc1a3cad6af..c73ecde9fbe 100644 --- a/src/plugins/platforms/wasm/qwasmwindowstack.cpp +++ b/src/plugins/platforms/wasm/qwasmwindowstack.cpp @@ -111,7 +111,7 @@ QWasmWindow *QWasmWasmWindowStack::rootWindow() const QWasmWindow *QWasmWasmWindowStack::topWindow() const { - return m_windowStack.last(); + return m_windowStack.empty() ? nullptr : m_windowStack.last(); } QWasmWasmWindowStack::StorageType::iterator QWasmWasmWindowStack::regularWindowsBegin() |
