[UNSOLVED]NullPointerException

Discussion in 'Plugin Development' started by LukeSFT, Sep 17, 2012.

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

    LukeSFT

    Why does the second line gives a NullPointerException??
    Code:
    inv
    .put(
    player, 
    items );
    
     
  2. Offline

    skore87

    Technically that is one line... Either "inv", "player", or "items" is null.
     
  3. Offline

    stirante

    inv is null for sure.Check if you created instance of HashMap.
     
  4. Offline

    skore87

    With his snippet of code, as it literally is only one line and stack traces point to the line number and not variable, there is no possibility to know that for certainty. It is likely though that it is the inventory variable.
     
  5. Offline

    stirante

    But I think that there is possibility to pass in HashMap null instead of some variable
     
  6. Offline

    Jnorr44

    do:
    log.info(inv.toString() + " --- " + player.toString() + " --- " + items.toString());

    if any one of those return null, theres your problem!
     
Thread Status:
Not open for further replies.

Share This Page