The code I'm using is this:
public ForumGroups getMainGroup() {
if (Constants.SQL_ENABLED) {
int lowest = -1;
ForumGroups g = null;
for (ForumGroup group : forumGroups) {
if (group.getGroup().ordinal() < lowest || g == null) {
lowest = group.getGroup().ordinal();
g = group.getGroup();
}
}
if (g == null)
return ForumGroups.MEMBER;
else
return g;
}
return ForumGroups.OWNER;
}
And I'm getting error on this line
if (group.getGroup().ordinal() < lowest || g == null) {
What do I do?
error here:
java.lang.NullPointerException
at ophion.rs.game.player.Player.getMainGroup(Player.java:4118)
at ophion.rs.game.player.Player.InterfaceManager$3.run(InterfaceManager.java:472)
at ophion.rs.game.tasks.WorldTasksManager.processTasks(WorldTasksManager.java:18)