From a15ae81651226322a8693e76a82f21b78d583172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Labb=C3=A9?= Date: Sat, 25 Jul 2015 00:11:39 -0400 Subject: [PATCH] fixed a crash after OpenNI2 initialization failure --- guilib/src/PreferencesDialog.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/guilib/src/PreferencesDialog.cpp b/guilib/src/PreferencesDialog.cpp index b3e85024..30322ab8 100644 --- a/guilib/src/PreferencesDialog.cpp +++ b/guilib/src/PreferencesDialog.cpp @@ -3558,17 +3558,19 @@ Camera * PreferencesDialog::createCamera(bool useRawImages) delete camera; camera = 0; } - - //should be after initialization - if(driver == kSrcOpenNI2) + else { - ((CameraOpenNI2*)camera)->setAutoWhiteBalance(this->getSourceOpenni2AutoWhiteBalance()); - ((CameraOpenNI2*)camera)->setAutoExposure(this->getSourceOpenni2AutoExposure()); - ((CameraOpenNI2*)camera)->setMirroring(this->getSourceOpenni2Mirroring()); - if(CameraOpenNI2::exposureGainAvailable()) + //should be after initialization + if(driver == kSrcOpenNI2) { - ((CameraOpenNI2*)camera)->setExposure(this->getSourceOpenni2Exposure()); - ((CameraOpenNI2*)camera)->setGain(this->getSourceOpenni2Gain()); + ((CameraOpenNI2*)camera)->setAutoWhiteBalance(this->getSourceOpenni2AutoWhiteBalance()); + ((CameraOpenNI2*)camera)->setAutoExposure(this->getSourceOpenni2AutoExposure()); + ((CameraOpenNI2*)camera)->setMirroring(this->getSourceOpenni2Mirroring()); + if(CameraOpenNI2::exposureGainAvailable()) + { + ((CameraOpenNI2*)camera)->setExposure(this->getSourceOpenni2Exposure()); + ((CameraOpenNI2*)camera)->setGain(this->getSourceOpenni2Gain()); + } } } }