From fb05e91d01cc9c7487a2d4a439ba00b95c5d31d7 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 7 Jun 2019 14:40:11 -0300 Subject: [PATCH] Hide "Recover Files" button when it's disabled (fix crash clicking it in this case) --- src/app/ui/home_view.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/ui/home_view.cpp b/src/app/ui/home_view.cpp index 2bdb9c18f..2db7c7c63 100644 --- a/src/app/ui/home_view.cpp +++ b/src/app/ui/home_view.cpp @@ -54,7 +54,10 @@ HomeView::HomeView() { newFile()->Click.connect(base::Bind(&HomeView::onNewFile, this)); openFile()->Click.connect(base::Bind(&HomeView::onOpenFile, this)); - recoverSprites()->Click.connect(base::Bind(&HomeView::onRecoverSprites, this)); + if (m_dataRecovery) + recoverSprites()->Click.connect(base::Bind(&HomeView::onRecoverSprites, this)); + else + recoverSprites()->setVisible(false); filesView()->attachToView(m_files); foldersView()->attachToView(m_folders); @@ -201,6 +204,11 @@ void HomeView::onNewUpdate(const std::string& url, const std::string& version) void HomeView::onRecoverSprites() { #ifdef ENABLE_DATA_RECOVERY + ASSERT(m_dataRecovery); // "Recover Files" button is hidden when + // data recovery is disabled (m_dataRecovery == nullptr) + if (!m_dataRecovery) + return; + if (!m_dataRecoveryView) { m_dataRecoveryView = new DataRecoveryView(m_dataRecovery);