Skip to content
Success

Changes

Summary

  1. Fix ServerPing NPE w/ String favicons (commit: 107d6b0) (details)
Commit 107d6b011db98e549b401ae56daa01d2701ad287 by md_5
Fix ServerPing NPE w/ String favicons

Currently, passing a null favicon String to the ServerPing(Protocol, Players, String, String) constructor causes a NPE. However, passing a null `Favicon` object to the corresponding constructor does not cause one. Setting the favicon String using the setFavicon(String) method doesn't cause a NPE either.

Therefore, the NPE thrown by the constructor is inconsistent and should be avoided. Please find a sample NPE here: http://newpaste.md-5.net/pmtqjc8vl (Note the `null` favicon)

This PR changes the documented (unintended?) behaviour by adding a null check before passing the favicon String to the alternative `Favicon` object constructor. This makes the constructor consistent with the other one and the `setFavicon(String)` method. This also adds compatibility for old (made before Favicon API) plugins passing `null` favicon Strings (and expecting no favicon to be displayed instead of a NPE).

Thanks!
(commit: 107d6b0)
The file was modifiedapi/src/main/java/net/md_5/bungee/api/ServerPing.java