diff --git a/src/devices/VirtualKeyboard.cpp b/src/devices/VirtualKeyboard.cpp index ca6156b7..fa91ae9f 100644 --- a/src/devices/VirtualKeyboard.cpp +++ b/src/devices/VirtualKeyboard.cpp @@ -55,6 +55,8 @@ bool CVirtualKeyboard::isVirtual() { } wlr_keyboard* CVirtualKeyboard::wlr() { + if (keyboard.expired()) + return nullptr; return keyboard.lock()->wlr(); } @@ -67,5 +69,7 @@ void CVirtualKeyboard::disconnectCallbacks() { } wl_client* CVirtualKeyboard::getClient() { + if (keyboard.expired()) + return nullptr; return keyboard.lock()->client(); } diff --git a/src/devices/VirtualPointer.cpp b/src/devices/VirtualPointer.cpp index 8f8699a2..2b46ff28 100644 --- a/src/devices/VirtualPointer.cpp +++ b/src/devices/VirtualPointer.cpp @@ -166,5 +166,7 @@ void CVirtualPointer::disconnectCallbacks() { } wlr_pointer* CVirtualPointer::wlr() { + if (pointer.expired()) + return nullptr; return pointer.lock()->wlr(); }