From 45ce2d3a17ff36ff71919923b7b7ea36ebb53c13 Mon Sep 17 00:00:00 2001 From: Ben Doherty Date: Fri, 24 Apr 2020 15:38:15 -0700 Subject: [PATCH] Fix crash when using free flight and hovering outside of the window (#2454) --- libs/filamentapp/src/FilamentApp.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/filamentapp/src/FilamentApp.cpp b/libs/filamentapp/src/FilamentApp.cpp index d26cb148f3..f9cac533e4 100644 --- a/libs/filamentapp/src/FilamentApp.cpp +++ b/libs/filamentapp/src/FilamentApp.cpp @@ -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) {