Q0rDev/MChat — pull request #65 by saladoc (2014-08-31 22:31:16+00:00)
Title: prevent breaking when a variable is null.

On our server we had the problem that passing any Player*Event to MChat failed because of a NPE for certain players. After finding out that the root of the problem was the Variables +geoRegion and +geoCity were null.

To prevent this from breaking the whole functionality of MChat I introduced this fix to our version so that any variable that may be null (whatever the reason may be) will not be able to break anything.

Stacktrace (relevant part) from the Errors Occuring:
java.lang.NullPointerException
> at ca.q0r.mchat.util.MessageUtil.addColour(MessageUtil.java:85) ~[?:?]
> at ca.q0r.mchat.variables.VariableManager.replacer(VariableManager.java:225) ~[?:?]
> at ca.q0r.mchat.variables.VariableManager.replaceVars(VariableManager.java:178) ~[?:?]
> at ca.q0r.mchat.events.custom.ParseEvent.parse(ParseEvent.java:146) ~[?:?]
> at ca.q0r.mchat.events.custom.ParseEvent.getParsed(ParseEvent.java:113) ~[?:?]
> at ca.q0r.mchat.api.Parser.parseMessage(Parser.java:29) ~[?:?]