From 83e7865130d6dae89d64e34c5660093261cbf0f4 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Thu, 3 Mar 2016 18:05:01 +0100 Subject: [PATCH] Fix crashing when hitting tab on no surface selected --- src/Application/ProjectionMappingState.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Application/ProjectionMappingState.cpp b/src/Application/ProjectionMappingState.cpp index 3dfd20c..cb5a0ba 100644 --- a/src/Application/ProjectionMappingState.cpp +++ b/src/Application/ProjectionMappingState.cpp @@ -174,10 +174,12 @@ void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & ar break; case OF_KEY_TAB: - app->getCmdManager()->exec( - new SetNextSourceCmd( - app->getSurfaceManager()->getSelectedSurface(), - app->getGui()->getSourcesEditor())); + if(app->getSurfaceManager()->getSelectedSurface() != 0){ + app->getCmdManager()->exec( + new SetNextSourceCmd( + app->getSurfaceManager()->getSelectedSurface(), + app->getGui()->getSourcesEditor())); + } break; default: