Browse Source

Merge pull request #227 from Chocimier/book

Prevent flipping empty spellbook
Alexander Shishkin 9 years ago
parent
commit
a92e820eb4
1 changed files with 1 additions and 1 deletions
  1. 1 1
      client/windows/CSpellWindow.cpp

+ 1 - 1
client/windows/CSpellWindow.cpp

@@ -224,7 +224,7 @@ CSpellWindow::CSpellWindow(const SDL_Rect &, const CGHeroInstance * _myHero, CPl
 	currentPage = battleSpellsOnly ? myInt->spellbookSettings.spellbookLastPageBattle : myInt->spellbookSettings.spellbokLastPageAdvmap;
 
 	// spellbook last page battle index is not reset after battle, so this needs to stay here
-	vstd::abetween(currentPage, 0, pagesWithinCurrentTab() - 1);
+	vstd::abetween(currentPage, 0, std::max(0, pagesWithinCurrentTab() - 1));
 
 	computeSpellsPerArea();
 	addUsedEvents(KEYBOARD);