[wayland] Add safety check for WaylandCursorTheme::get

It's possible that loadTheme fails in which case m_theme is null
and would crash the wayland cursor library.
This commit is contained in:
Martin Gräßlin 2015-01-09 16:02:03 +01:00
parent 65007cd104
commit 2cd25257d9

View file

@ -351,6 +351,10 @@ wl_cursor_image *WaylandCursorTheme::get(Qt::CursorShape shape)
if (!m_theme) {
loadTheme();
}
if (!m_theme) {
// loading cursor failed
return nullptr;
}
wl_cursor *c = wl_cursor_theme_get_cursor(m_theme, Cursor::self()->cursorName(shape).constData());
if (!c || c->image_count <= 0) {
return nullptr;