diff --git a/include/book.h b/include/book.h index 0f21bc481..04d71b1a3 100644 --- a/include/book.h +++ b/include/book.h @@ -48,6 +48,8 @@ class Book { friend class Book; public: + uint16_t width = 48; + uint16_t height = 48; std::string mimeType; std::string url; diff --git a/src/book.cpp b/src/book.cpp index faee20dfe..50a144bb6 100644 --- a/src/book.cpp +++ b/src/book.cpp @@ -226,8 +226,12 @@ void Book::setPath(const std::string& path) const Book::Illustration& Book::getDefaultIllustration() const { - assert(m_illustrations.size() == 1); - return *m_illustrations.front(); + for ( const auto& ilPtr : m_illustrations ) { + if (ilPtr->width == 48 && ilPtr->height == 48) { + return *ilPtr; + } + } + throw std::runtime_error("No default illustration"); } Book::Illustration& Book::getMutableDefaultIllustration()