mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
Fix bug in Render::nextDoublePage() function that could lead to segfault if the last page is a double page. Also fixes related bug that could lead to advancing beyond the actual page count.
This commit is contained in:
parent
bf5c0e9326
commit
398faff9d4
@ -850,12 +850,21 @@ void Render::nextPage()
|
||||
emit pageChanged(currentIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit isLast();
|
||||
}
|
||||
}
|
||||
void Render::nextDoublePage()
|
||||
{
|
||||
int nextPage;
|
||||
if (currentIndex +2 < (int)comic->numPages())
|
||||
{
|
||||
nextPage = currentIndex+2;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextPage = currentIndex;
|
||||
}
|
||||
if(currentIndex != nextPage)
|
||||
{
|
||||
comic->setIndex(nextPage);
|
||||
@ -864,6 +873,10 @@ void Render::nextDoublePage()
|
||||
update();
|
||||
emit pageChanged(currentIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit isLast();
|
||||
}
|
||||
}
|
||||
|
||||
//si se solicita la página anterior, se calcula cuál debe ser en función de si se lee en modo a doble página o no.
|
||||
@ -882,8 +895,10 @@ void Render::previousPage()
|
||||
emit pageChanged(currentIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit isCover();
|
||||
}
|
||||
}
|
||||
|
||||
void Render::previousDoublePage()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user