[Solved] Java hashmaps go missing after a period of not using them [duplicate]


for (Location l : RunicParadise.explorerLocations.values()) {
        **[NPE THROWN HERE] if (l.getWorld().getName().equals(loc.getWorld().getName())) {**

So the one thing that wasn’t null here was the HashMap: explorerLocations. Otherwise you would have got the NPE on the previous line where you called HashMap.values().

Any of l, l.getWorld(), l.getWorld().getName(), loc, or loc.getWorld() could be null.

You’re barking up the wrong tree.

3

solved Java hashmaps go missing after a period of not using them [duplicate]