mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-20 18:33:38 -04:00
Safer ContentManager::downloadDisappeared()
This commit is contained in:
parent
8e4e394f99
commit
2a1d53f0b0
@ -467,7 +467,15 @@ void ContentManager::removeDownload(QString bookId)
|
||||
void ContentManager::downloadDisappeared(QString bookId)
|
||||
{
|
||||
removeDownload(bookId);
|
||||
kiwix::Book bCopy(mp_library->getBookById(bookId));
|
||||
kiwix::Book bCopy;
|
||||
try {
|
||||
bCopy = mp_library->getBookById(bookId);
|
||||
} catch ( const std::out_of_range& ) {
|
||||
// If the download has disappeared as a result of some
|
||||
// obscure chain of events, the book may have disappeared too.
|
||||
return;
|
||||
}
|
||||
|
||||
bCopy.setDownloadId("");
|
||||
mp_library->getKiwixLibrary()->addOrUpdateBook(bCopy);
|
||||
mp_library->save();
|
||||
|
Loading…
x
Reference in New Issue
Block a user