Merge pull request #156 from cjcliffe/master

Two crash fixes from master branch
This commit is contained in:
Charles J. Cliffe 2015-10-09 12:58:44 -04:00
commit 207d61cd0c
2 changed files with 13 additions and 7 deletions

View File

@ -428,7 +428,7 @@ bool AudioThread::isActive() {
void AudioThread::setActive(bool state) {
AudioThreadInput *dummy;
if (state && !active) {
if (state && !active && inputQueue) {
while (!inputQueue->empty()) { // flush queue
inputQueue->pop(dummy);
if (dummy) {
@ -438,10 +438,12 @@ void AudioThread::setActive(bool state) {
deviceController[parameters.deviceId]->bindThread(this);
} else if (!state && active) {
deviceController[parameters.deviceId]->removeThread(this);
while (!inputQueue->empty()) { // flush queue
inputQueue->pop(dummy);
if (dummy) {
dummy->decRefCount();
if(inputQueue) {
while (!inputQueue->empty()) { // flush queue
inputQueue->pop(dummy);
if (dummy) {
dummy->decRefCount();
}
}
}
}

View File

@ -41,8 +41,12 @@ int SDRThread::enumerate_rtl(std::vector<SDRDeviceInfo *> *devs) {
deviceProduct = product;
deviceManufacturer = manufact;
rtlsdr_dev_t *devTest;
rtlsdr_open(&devTest, i);
rtlsdr_dev_t *devTest = nullptr;
if(rtlsdr_open(&devTest, i) < 0)
{
std::cout << "\tFailed to open device " << i << std::endl;
continue;
}
std::cout << "\t Tuner type: ";
switch (rtlsdr_get_tuner_type(devTest)) {