From 27f7b38d719322dd60c38df98ee76c81961252ef Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 28 Aug 2021 20:19:55 +0000 Subject: Return null from DcAccounts::getSelectedAccount if there are no accounts --- accounts.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/accounts.cpp b/accounts.cpp index 8a71668..5ae7363 100644 --- a/accounts.cpp +++ b/accounts.cpp @@ -58,8 +58,11 @@ Context * DcAccounts::getSelectedAccount() { dc_context_t *context = dc_accounts_get_selected_account(m_accounts); - - return new Context(this, context); + if (context) { + return new Context(this, context); + } else { + return nullptr; + } } bool -- cgit v1.2.3-54-g00ecf