Fix unconstrained code for PlayerInvDisplay menu updating #704
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #703
This greatly demonstrated an example of what could happen when low level programming bugged in high level language. If it is C/C++, just undefined bahaviour instead of an exception or error.
This should be a bug since 2.2.0-dev1 (29f6ff8). I believe it was because the code was copied directly from
ContainerDisplay
without further examination and modification. It should be aArrayIndexOutOfBoundsException
but since 2.2.0-dev4 (33c5083), a description menu has been added, so the 1st menu become the description menu when not in creative mode and thus not the requestedInventoryMenu
(ClassCastException
), causing the exception.The part of code is executed when a stack of item is updated when in menu or inventory is updated when items moved between player inventory and list of item (only in creative mode). Only the action of dropping item updating item stacks is available for non-creative mode, other than the deletion of items in creative mode. The logic is errored and an exception is thrown only when in non-creative mode. Since
2.2.0-dev1
,ArrayIndexOutOfBoundsException
will be thrown while since2.2.0-dev4
,ClassCastException
will be thrown, on the same line of code.