From b30bb22bb81973cd98f9b0f612bf7750243a940e Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Fri, 5 Aug 2022 19:41:50 +0200 Subject: [PATCH] fix crash in getMaxSizeForWindow --- src/managers/XWaylandManager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index 5688a849..10e3c6d4 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -233,6 +233,12 @@ void CHyprXWaylandManager::setWindowFullscreen(CWindow* pWindow, bool fullscreen } Vector2D CHyprXWaylandManager::getMaxSizeForWindow(CWindow* pWindow) { + if (!g_pCompositor->windowValidMapped(pWindow)) + return Vector2D(99999, 99999); + + if ((pWindow->m_bIsX11 && !pWindow->m_uSurface.xwayland->size_hints) || (!pWindow->m_bIsX11 && !pWindow->m_uSurface.xdg->toplevel)) + return Vector2D(99999, 99999); + auto MAXSIZE = pWindow->m_bIsX11 ? Vector2D(pWindow->m_uSurface.xwayland->size_hints->max_width, pWindow->m_uSurface.xwayland->size_hints->max_height) : Vector2D(pWindow->m_uSurface.xdg->toplevel->current.max_width, pWindow->m_uSurface.xdg->toplevel->current.max_height);