From a7137460f0cb10e128132145e8681e4444fb5191 Mon Sep 17 00:00:00 2001 From: Albert S Date: Mon, 5 Nov 2018 10:48:58 +0100 Subject: [PATCH] PageDaoSqlite::find: Return empty if not page found --- database/pagedaosqlite.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/database/pagedaosqlite.cpp b/database/pagedaosqlite.cpp index 3de7e0d..2790cfa 100644 --- a/database/pagedaosqlite.cpp +++ b/database/pagedaosqlite.cpp @@ -40,8 +40,15 @@ bool PageDaoSqlite::exists(std::string name) const std::optional PageDaoSqlite::find(std::string name) { - int pageid = fetchPageId(name); - return find(pageid); + try + { + int pageid = fetchPageId(name); + return find(pageid); + } + catch(const sqlite::errors::no_rows &e) + { + return { }; + } } std::optional PageDaoSqlite::find(unsigned int id)