Fix crash when using free flight and hovering outside of the window (#2454)

This commit is contained in:
Ben Doherty
2020-04-24 15:38:15 -07:00
committed by GitHub
parent 1b6c25ce68
commit 45ce2d3a17

View File

@@ -656,7 +656,7 @@ void FilamentApp::Window::keyDown(SDL_Scancode key) {
}
// Decide which view will get this key's corresponding keyUp event.
// If we're currently in a mouse grap session, it should be the mouse grap's target view.
// If we're currently in a mouse grap session, it should be the mouse grab's target view.
// Otherwise, it should be whichever view we're currently hovering over.
CView* targetView = nullptr;
if (mMouseEventTarget) {
@@ -670,8 +670,10 @@ void FilamentApp::Window::keyDown(SDL_Scancode key) {
}
}
targetView->keyDown(key);
eventTarget = targetView;
if (targetView) {
targetView->keyDown(key);
eventTarget = targetView;
}
}
void FilamentApp::Window::keyUp(SDL_Scancode key) {