Skip to content

Commit

Permalink
Merge pull request #155 from eoineoineoin/master
Browse files Browse the repository at this point in the history
Fixes for two crashes
  • Loading branch information
cjcliffe committed Oct 8, 2015
2 parents 7a01c43 + 0b10a5b commit 845c74f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/audio/AudioThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
}
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/sdr/SDRThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 845c74f

Please sign in to comment.