From f2e4981fdcb93fbf466f31c14019dea9022c74e5 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 27 Aug 2024 16:41:34 +0300 Subject: [PATCH] add exceptions --- src/app/browser/main/tab.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index 893d26eb..d4bb9632 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -33,14 +33,14 @@ Glib::ustring Tab::get_page_title( PAGE_NUMBER ); - if (pageWidget != nullptr) + if (pageWidget == nullptr) { - auto tabPage = (tab::Page *) pageWidget; - - return tabPage->get_title(); + throw _("Tab page not found!"); } - return ""; // @TODO + auto tabPage = (tab::Page *) pageWidget; + + return tabPage->get_title(); }; Glib::ustring Tab::get_page_subtitle( @@ -50,14 +50,14 @@ Glib::ustring Tab::get_page_subtitle( PAGE_NUMBER ); - if (pageWidget != nullptr) + if (pageWidget == nullptr) { - auto tabPage = (tab::Page *) pageWidget; - - return tabPage->get_subtitle(); + throw _("Tab page not found!"); } - return ""; // @TODO + auto tabPage = (tab::Page *) pageWidget; + + return tabPage->get_subtitle(); }; // Actions