Fix a crash when typing in the search bar ~

This commit is contained in:
Ellpeck 2016-11-12 16:06:30 +01:00
parent 05322f1392
commit ecafafe57e

View file

@ -44,8 +44,13 @@ public class GuiEntry extends GuiBooklet{
this.focusSearch = focusSearch;
this.chapters = entry.getChaptersForDisplay(search);
IBookletChapter lastChap = this.chapters.get(this.chapters.size()-1);
this.pageAmount = lastChap == null ? 1 : calcEntryPage(this.entry, lastChap, this.searchText)+1;
if(!this.chapters.isEmpty()){
IBookletChapter lastChap = this.chapters.get(this.chapters.size()-1);
this.pageAmount = lastChap == null ? 1 : calcEntryPage(this.entry, lastChap, this.searchText)+1;
}
else{
this.pageAmount = 1;
}
}
public GuiEntry(GuiScreen previousScreen, GuiBookletBase parentPage, IBookletEntry entry, IBookletChapter chapterForPageCalc, String search, boolean focusSearch){