player.isOnline() = nullpointerexception??

Discussion in 'Plugin Development' started by paxi, Jun 23, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    paxi

    Hello everybody,

    today i worked at a big project which always runned the whole day. Since 30 minutes i always get the error:

    [19:45:44 ERROR]: Error occurred while enabling [pluginname](Is it up to date?)
    java.lang.NullPointerException
    XXXXX.XXXX.XXXXXXXXX.isOnline(PlayerObject.java:63) ~[?:?]
    .............................

    line 63 is the red line:

    public boolean isOnline() {
    return player.isOnline();
    }

    Player is a OfflinePlayer attribute....

    Maybe somebody can say me why ?
    I did so much so i have many things to check....
     
  2. Offline

    Gnat008

    Sounds like the variable 'player' has not been initialized, meaning it has no value (read, is null), hence the NullPointerException.
     
  3. Code:java
    1. public boolean isOnline(Player player) {
    2. return player.isOnline();
    3. }
    4.  


    use this ;)
     
  4. Offline

    1Rogue


    Wouldn't prevent an NPE if "player" is null.
     
Thread Status:
Not open for further replies.

Share This Page