Possible null pointer calls, fix unnecessary context switches

This commit is contained in:
Charles J. Cliffe
2015-10-22 01:42:50 -04:00
parent 1e0489f974
commit e61caaf5a6
2 changed files with 11 additions and 6 deletions
+4 -2
View File
@@ -255,7 +255,9 @@ void DemodulatorInstance::setOutputDevice(int device_id) {
int DemodulatorInstance::getOutputDevice() {
if (currentOutputDevice == -1) {
currentOutputDevice = audioThread->getOutputDevice();
if (audioThread) {
currentOutputDevice = audioThread->getOutputDevice();
}
}
return currentOutputDevice;
@@ -308,7 +310,7 @@ void DemodulatorInstance::setBandwidth(int bw) {
bw = AudioThread::deviceSampleRate[getOutputDevice()];
}
}
if (!active) {
if (!active && demodulatorPreThread != NULL) {
currentBandwidth = bw;
checkBandwidth();
demodulatorPreThread->getParams().bandwidth = currentBandwidth;