[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:
parent
65007cd104
commit
2cd25257d9
1 changed files with 4 additions and 0 deletions
|
@ -351,6 +351,10 @@ wl_cursor_image *WaylandCursorTheme::get(Qt::CursorShape shape)
|
||||||
if (!m_theme) {
|
if (!m_theme) {
|
||||||
loadTheme();
|
loadTheme();
|
||||||
}
|
}
|
||||||
|
if (!m_theme) {
|
||||||
|
// loading cursor failed
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
wl_cursor *c = wl_cursor_theme_get_cursor(m_theme, Cursor::self()->cursorName(shape).constData());
|
wl_cursor *c = wl_cursor_theme_get_cursor(m_theme, Cursor::self()->cursorName(shape).constData());
|
||||||
if (!c || c->image_count <= 0) {
|
if (!c || c->image_count <= 0) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Reference in a new issue