Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix NPE crash when changing focus using TAB (#201)
`SearchFieldEntry.children()` was returning `List.of(editBox)`, which itself returns an "unmodifiable" list. Unmodifiable lists do not permit null entries, and [`indexOf()` will throw a `NullPointerException`][1] if the specified element is `null` and the list does not permit `null` elements. This reveals a bug in vanilla's `ContainerEventHandler#changeFocus(boolean)` method, where `indexOf()` is called without a null-check, causing the crash. Instead, we can use `Collections.singletonList()` which returns a `SingletonList`. Still immutable, but no silly NPEs. Fixes #176 [1]: https://docs.oracle.com/javase/8/docs/api/java/util/List.html#indexOf-java.lang.Object-
- Loading branch information