From b68596e6069eba3c7df64cf43ab48021a9b00051 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 17 Jun 2015 21:06:05 +0200 Subject: [PATCH] fixed bug causing an out of index crash in YACReader(stand alone) when lastPageRead(from file bookmarks) >= numPages.lenght() --- common/comic.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/comic.cpp b/common/comic.cpp index ffb5ffaf..9a148cda 100644 --- a/common/comic.cpp +++ b/common/comic.cpp @@ -515,6 +515,10 @@ void FileComic::process() if(_firstPage == -1) _firstPage = bm->getLastPage(); + + if(_firstPage >= _pages.length()) + _firstPage = 0; + _index = _firstPage; emit(openAt(_index)); @@ -602,6 +606,9 @@ void FolderComic::process() if(_firstPage == -1) _firstPage = bm->getLastPage(); + if(_firstPage >= _pages.length()) + _firstPage = 0; + _index = _firstPage; emit(openAt(_index)); @@ -742,6 +749,10 @@ void PDFComic::process() if(_firstPage == -1) _firstPage = bm->getLastPage(); + + if(_firstPage >= _pages.length()) + _firstPage = 0; + _index = _firstPage; emit(openAt(_index));