From a4100d5b4e210f70a105d5cd728584e9f6014f9f Mon Sep 17 00:00:00 2001 From: Lynix Date: Fri, 17 Feb 2017 00:21:40 +0100 Subject: [PATCH] Utility/X11: Fix crash at startup --- src/Nazara/Utility/X11/CursorImpl.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Nazara/Utility/X11/CursorImpl.cpp b/src/Nazara/Utility/X11/CursorImpl.cpp index 94f10629e..aa59290b3 100644 --- a/src/Nazara/Utility/X11/CursorImpl.cpp +++ b/src/Nazara/Utility/X11/CursorImpl.cpp @@ -164,8 +164,19 @@ namespace Nz ScopedXCBConnection connection; xcb_screen_t* screen = X11::XCBDefaultScreen(connection); - if (xcb_cursor_context_new(connection, screen, &m_cursorContext) >= 0) - m_cursor = xcb_cursor_load_cursor(m_cursorContext, s_systemCursorIds[cursor]); + const char* cursorName = s_systemCursorIds[cursor]; + if (cursorName) + { + if (xcb_cursor_context_new(connection, screen, &m_cursorContext) >= 0) + m_cursor = xcb_cursor_load_cursor(m_cursorContext, cursorName); + else + { + NazaraError("Failed to create cursor context"); + return false; + } + } + else + m_cursor = s_hiddenCursor; return true; }