gigaherz / Guidebook

Minecraft book API and library
https://www.curseforge.com/minecraft/mc-mods/guidebook
Other
31 stars 16 forks source link

[Bug] Crash when opening book with empty chapters/sections #80

Open ElectroBot opened 5 years ago

ElectroBot commented 5 years ago

The book below (with and without the empty sections) crashes the game. I was trying to find out how to have empty pages (realized later the sections are the pages).

`

`

Minecraft: 1.12.2 Forge: 14.23.5.2772 Guidebook: 1.12.2-2.8.3

Crash report: https://paste.dimdev.org/apusogiwor.rb

QbDesu commented 5 years ago

Yes this is an issue with empty chapters. https://github.com/gigaherz/Guidebook/blob/cea8c047bd9457e49656d8dbbed5d8a22685585b/src/main/java/gigaherz/guidebook/guidebook/client/BookRendering.java#L475 The line above throws an IndexOutOfBoundsException. A possible way to fix this would be applying the same checks that are applied to the right-hand page for the left-hand page as well. Alternatively empty chapters could be removed and maybe a book without a chapter would not be able to open or automatically appear blank.

ElectroBot commented 5 years ago

There are uses for empty pages though (aesthetic). Not sure if applying the checks or maybe adding a tag for an blank page would doable.

gigaherz commented 5 years ago

It's definitely a bug that needs fixing. Just gotta get around to it.

On Sat, 17 Nov 2018, 18:43 ElectroBot <notifications@github.com wrote:

There are uses for empty pages though (aesthetic). Not sure if applying the checks or maybe adding a tag for an blank page would doable.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gigaherz/Guidebook/issues/80#issuecomment-439634398, or mute the thread https://github.com/notifications/unsubscribe-auth/AAp3Gy-176uNHfau_Ova8L2WvDXuZaC7ks5uwEq6gaJpZM4YLSIq .