Skip to content

NPE in context's paginatorΒ #220

Description

@devnatan

Is there an existing issue for this?

  • I have searched the existing issues

πŸ› Describe the bug

NullPointerException when trying to access context paginator by checking pages (hasNextPage, hasPreviousPage, etc) and source was set on root

on root constructor

setSource(...)

then try to use hasNextPage on any context. Nothing is thrown if source is set by context.

βœ”οΈ Expected behavior

Context must inherit getPaginator from root in these functions since they are used after render by user.

πŸ‘£ Steps to Reproduce

No response

πŸ’» Platform

  • Bukkit
  • Sponge
  • Other

⭐ Versions

IF v2.5.4-beta

✍️ Additional context

java.lang.NullPointerException: Cannot invoke "me.saiintbrisson.minecraft.Paginator.hasPage(int)" because the return value of "me.saiintbrisson.minecraft.BasePaginatedViewContext.getPaginator()" is null
        at me.saiintbrisson.minecraft.BasePaginatedViewContext.hasNextPage(BasePaginatedViewContext.java:80) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.BasePaginatedViewContext.isLastPage(BasePaginatedViewContext.java:90) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.BasePaginatedViewContext.switchToNextPage(BasePaginatedViewContext.java:113) ~[inventory-framework-2.5.4-beta-all.jar:?]
        at me.saiintbrisson.minecraft.pipeline.interceptors.NavigationControllerInterceptor.lambda$updateNavigationItem$0(NavigationControllerInterceptor.java:118) ~[inventory-framework-2.5.4-beta-all.jar:?]

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions