games647 / ScoreboardStats

Bukkit plugin for customizing the sidebar of the scoreboard feature from minecraft
https://dev.bukkit.org/bukkit-mods/scoreboardstats/
MIT License
28 stars 45 forks source link

Check if objective is null before checking its name #68

Closed iPyronic closed 9 years ago

games647 commented 9 years ago

Please provide a reason for this change.

iPyronic commented 9 years ago

Someone on the Spigot forums had a thread and was asking about the errors he/she had in their server log. One of the errors was in ScoreboardStats: http://pastebin.com/SfKLQ84u

The objective will be null if the player doesn't have anything in their sidebar, right? So it should probably be checked before trying to compare the name.

I kinda don't know how to use github correctly though... so I'm guessing I did this pull request wrong o.o

games647 commented 9 years ago

No the pr is alright. I thought this shouldn't happen, because it's already checked here.

In the error you posted. A new scoreboard is created and should be available so. Maybe another plugin modifies the scoreboards async? Could you post the link to the thread?

iPyronic commented 9 years ago

Sure, this is the thread: https://www.spigotmc.org/threads/world-file-error.97155/

The person didn't post the full server log though, so there isn't a list of their plugins :/

The log that was posted contained this error in ScoreboardStats twice, and I'm guessing they were both about a minute apart (although the first one is missing the time).

By the way, I noticed the latest version on bukkit is 0.9.1, but the github says 0.9.3, dunno if that changes anything relevant though.

games647 commented 9 years ago

Interesting... I found that TeamPvP uses sidebar scoreboards too, but this plugins also runs sync (as far as I know). According to the log the sidebar objective was null and then ScoreboardStats created a new objective. Only on success it should call the method sendUpdate(Player, boolean). So I think there are async modifications.

By the way, I noticed the latest version on bukkit is 0.9.1, but the github says 0.9.3, dunno if that changes anything relevant though.

But I guess there are no changes relevant to this.

Anyways a null-check is always a good practise.