diff --git a/CHANGELOG.md b/CHANGELOG.md index d718ed66..8901698a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Version counting is based on semantic versioning (Major.Feature.Patch) * New setting to open comics in third party reader apps, it works by entering a command that will launch the app, e.g. "/path/to/the/app {comic_file_path}". You can use `{comic_file_path}` as a placeholder where `YACReaderLibrary` will place thet path to the comic file. * Purge covers and metadata not being used after a full library update. * Fix crash when updating the current folder content after a library update. +* Fix crash when current folders is empty after an update. ### YACReaderLibraryServer * New command --system-info to print information about the execution environment and available resources (including what image formats are supported and what libraries are used by the app). diff --git a/YACReaderLibrary/comics_view.cpp b/YACReaderLibrary/comics_view.cpp index b20a4239..b2cca088 100644 --- a/YACReaderLibrary/comics_view.cpp +++ b/YACReaderLibrary/comics_view.cpp @@ -63,6 +63,13 @@ void ComicsView::updateInfoForIndex(int index) if (comicDB != nullptr) delete comicDB; + if ((index < 0) || (index >= model->rowCount())) { + ctxt->setContextProperty("comic", nullptr); + ctxt->setContextProperty("comicInfo", nullptr); + ctxt->setContextProperty("comic_info_index", -1); + return; + } + comicDB = new ComicDB(model->getComic(this->model->index(index, 0))); ComicInfo *comicInfo = &(comicDB->info); comicInfo->isFavorite = model->isFavorite(model->index(index, 0));