SamJakob/SpiGUI

Cannot invoke "java.util.function.Consumer.accept(Object)" because "this.onPageChange" is null when trying to setCurrentPage(1)

raph559 opened this issue · 2 comments

Hello !
I don't know how to fix that, maybe I'm just using the function wrong, but I don't think so.
Can someone help me ?

Can you provide the stack trace and/or the snippet of code from your project where the error occurs?

Of course, here it is :
configMenu.setButton(0, 10,new SGButton(new ItemBuilder(Material.BONE) .name("Editer les règles") .build()) .withListener(event -> {configMenu.setCurrentPage(1);}) );
The error refers to those lines on SGMenu.java :
public void setCurrentPage (int page) { this.currentPage = page; this.onPageChange.accept(this); }