From 868b2b544abb61764089b0e4e9b0fd153a9db26f Mon Sep 17 00:00:00 2001 From: nyx Date: Thu, 6 Feb 2025 06:16:47 -0500 Subject: [PATCH] window: fix missing surface null checks to prevent crashes (#9350) --- src/desktop/Window.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index c71fe652..b5126b67 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -1730,7 +1730,10 @@ void CWindow::sendWindowSize(Vector2D size, bool force, std::optional } NContentType::eContentType CWindow::getContentType() { - return m_pWLSurface->resource()->contentType.valid() ? m_pWLSurface->resource()->contentType->value : CONTENT_TYPE_NONE; + if (!m_pWLSurface || !m_pWLSurface->resource() || !m_pWLSurface->resource()->contentType.valid()) + return CONTENT_TYPE_NONE; + + return m_pWLSurface->resource()->contentType->value; } void CWindow::setContentType(NContentType::eContentType contentType) {