From 1fdaa112ea63f3189a227ed3da0a5f0535b600a9 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Wed, 8 Jul 2015 23:32:30 -0400 Subject: [PATCH] basic startup tweaks... ;) --- src/CubicSDR.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/CubicSDR.cpp b/src/CubicSDR.cpp index 64cf57a..3e47710 100644 --- a/src/CubicSDR.cpp +++ b/src/CubicSDR.cpp @@ -85,13 +85,24 @@ bool CubicSDR::OnInit() { choices.Add(devName); } - int devId = wxGetSingleChoiceIndex(wxT("Devices"), wxT("Choose Input Device"), choices); + int devId = wxGetSingleChoiceIndex(wxT("Devices"), wxT("Choose Input Device"), choices); + if (devId == -1) { // User chose to cancel + return false; + } + dev = devs[devId]; sdrThread->setDeviceId(devId); } else if (devs.size() == 1) { dev = devs[0]; } + + if (!dev) { + wxMessageDialog *info; + info = new wxMessageDialog(NULL, wxT("\x28\u256F\xB0\u25A1\xB0\uFF09\u256F\uFE35\x20\u253B\u2501\u253B"), wxT("RTL-SDR device not found"), wxOK | wxICON_ERROR); + info->ShowModal(); + return false; + } t_PostSDR = new std::thread(&SDRPostThread::threadMain, sdrPostThread); t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);