From 6213819fa5c8615b3bfcd40102d8dbf26cce50b0 Mon Sep 17 00:00:00 2001 From: Phil Olynyk Date: Mon, 25 Mar 2019 17:37:26 -0400 Subject: [PATCH] Enable buttons and tabs if machine data is available --- oscar/welcome.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/oscar/welcome.cpp b/oscar/welcome.cpp index 9bba7b6f..7af15cf7 100644 --- a/oscar/welcome.cpp +++ b/oscar/welcome.cpp @@ -32,9 +32,14 @@ Welcome::~Welcome() void Welcome::refreshPage() { - const auto & mlist = p_profile->GetMachines(MT_CPAP); + bool b; + + if (p_profile != nullptr) { + const auto & mlist = p_profile->GetMachines(MT_CPAP); + b = mlist.size() > 0; + } else + b = false; - bool b = mlist.size() > 0; bool showCardWarning = !b; @@ -52,9 +57,9 @@ void Welcome::refreshPage() ui->dailyButton->setEnabled(b); ui->overviewButton->setEnabled(b); ui->statisticsButton->setEnabled(b); -// ui->tabWidget->setTabEnabled(2, b); -// ui->tabWidget->setTabEnabled(3, b); -// ui->tabWidget->setTabEnabled(4, b); + ui->tabWidget->setTabEnabled(2, b); + ui->tabWidget->setTabEnabled(3, b); + ui->tabWidget->setTabEnabled(4, b); ui->cpapInfo->setHtml(GenerateCPAPHTML()); ui->oxiInfo->setHtml(GenerateOxiHTML());