From f0ce50c2da5548c96528c938dfd32b291a2dc4cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 10 Jun 2023 09:42:58 +0200 Subject: [PATCH] Do not insert garbage in the DB if replacing a comic goes bad. --- YACReaderLibrary/library_creator.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/YACReaderLibrary/library_creator.cpp b/YACReaderLibrary/library_creator.cpp index 46bb0c25..a68e1bbc 100644 --- a/YACReaderLibrary/library_creator.cpp +++ b/YACReaderLibrary/library_creator.cpp @@ -351,6 +351,14 @@ void LibraryCreator::replaceComic(const QString &relativePath, const QFileInfo & ComicDB insertedComic = DBHelper::loadComic(fileInfo.fileName(), relativePath, hash, _database); + if (!insertedComic.info.existOnDb) { + return; + } + + if (insertedComic.info.coverSizeRatio.isNull()) { + return; + } + auto numPages = insertedComic.info.numPages; auto coverSize = insertedComic.info.originalCoverSize; auto coverRatio = insertedComic.info.coverSizeRatio;