From 00bea4d274b3249f053252e0f8da904407e44ddd Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 5 May 2015 11:05:28 -0700 Subject: [PATCH] fix crash for NULL deviceProxy --- interface/src/ui/UserInputMapper.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/src/ui/UserInputMapper.cpp b/interface/src/ui/UserInputMapper.cpp index 892ab6a9b6..259d08b4b7 100755 --- a/interface/src/ui/UserInputMapper.cpp +++ b/interface/src/ui/UserInputMapper.cpp @@ -90,7 +90,7 @@ void UserInputMapper::update(float deltaTime) { bool isActiveModifier = false; for (auto& modifier : modifiersIt->second) { auto deviceProxy = getDeviceProxy(modifier); - if (deviceProxy->getButton(modifier, currentTimestamp)) { + if (deviceProxy && deviceProxy->getButton(modifier, currentTimestamp)) { validModifiers.push_back(modifier); isActiveModifier |= (modifier.getID() == inputMapping._modifier.getID()); } @@ -99,8 +99,8 @@ void UserInputMapper::update(float deltaTime) { } // if enabled: default input or all modifiers on - if (enabled) { - auto deviceProxy = getDeviceProxy(inputID); + auto deviceProxy = getDeviceProxy(inputID); + if (enabled && deviceProxy) { switch (inputMapping._input.getType()) { case ChannelType::BUTTON: { _actionStates[channelInput.first] += inputMapping._scale * float(deviceProxy->getButton(inputID, currentTimestamp));// * deltaTime; // weight the impulse by the deltaTime