Noted a potential bug in Library::addBook()

This commit is contained in:
Veloman Yunkan 2021-11-28 20:04:10 +04:00
parent ad2eb52553
commit 1d5383435d
1 changed files with 3 additions and 1 deletions

View File

@ -108,7 +108,9 @@ bool Library::addBook(const Book& book)
if ( ! booksReferToTheSameArchive(oldbook, book) ) { if ( ! booksReferToTheSameArchive(oldbook, book) ) {
dropReader(book.getId()); dropReader(book.getId());
} }
oldbook.update(book); oldbook.update(book); // XXX: This may have no effect if oldbook is readonly
// XXX: Then m_bookDB will become out-of-sync with
// XXX: the real contents of the library.
return false; return false;
} catch (std::out_of_range&) { } catch (std::out_of_range&) {
m_books[book.getId()] = book; m_books[book.getId()] = book;