Non-throwing Book::getDefaultIllustration()

This commit is contained in:
Veloman Yunkan
2021-11-18 13:57:34 +04:00
parent c8da5eea2b
commit 8a6adddc16
2 changed files with 7 additions and 1 deletions

View File

@ -231,6 +231,8 @@ void Book::setPath(const std::string& path)
: path;
}
const Book::Illustration Book::missingDefaultIllustration;
const Book::Illustration& Book::getDefaultIllustration() const
{
for ( const auto& ilPtr : m_illustrations ) {
@ -238,7 +240,7 @@ const Book::Illustration& Book::getDefaultIllustration() const
return *ilPtr;
}
}
throw std::runtime_error("No default illustration");
return missingDefaultIllustration;
}
const std::string& Book::Illustration::getData() const