From c58b15c6da180c2d141316ef0cf5bd35417da78e Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 22 Mar 2022 17:31:19 +0100 Subject: Fix a crash with setting title --- src/managers/XWaylandManager.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/managers/XWaylandManager.cpp') diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index ac183023..05717a58 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -49,10 +49,23 @@ void CHyprXWaylandManager::getGeometryForWindow(CWindow* pWindow, wlr_box* pbox) } std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) { - if (pWindow->m_bIsX11) - return pWindow->m_uSurface.xwayland->title; + if (pWindow->m_bIsX11) { + if (pWindow->m_uSurface.xwayland) { + return pWindow->m_uSurface.xwayland->title; + } + } else { + return ""; + } + + if (pWindow->m_uSurface.xdg) { + if (pWindow->m_uSurface.xdg->toplevel) { + return pWindow->m_uSurface.xdg->toplevel->title; + } + } else { + return ""; + } - return pWindow->m_uSurface.xdg->toplevel->title; + return ""; } void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) { @@ -114,4 +127,4 @@ void CHyprXWaylandManager::moveXWaylandWindow(CWindow* pWindow, const Vector2D& if (pWindow->m_bIsX11) { wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pos.x, pos.y, pWindow->m_vRealSize.x, pWindow->m_vRealSize.y); } -} \ No newline at end of file +} -- cgit v1.2.3