Why does my code cause a nullpointer?
<p>This is the exception:</p>

<pre><code>java.lang.NullPointerException
    at com.rs.net.decoders.handlers.InventoryOptionsHandler$2.run(InventoryOptionsHandler.java:512)
    at com.rs.game.player.CoordsEvent.processEvent(CoordsEvent.java:55)
    at com.rs.game.player.Player.processEntity(Player.java:357)
    at com.rs.cores.WorldProcessor.process(WorldProcessor.java:39)
    at com.rs.cores.PriorityProcessor.run(PriorityProcessor.java:10)
</code></pre>

<p>Here is the code:</p>

<p>InventoryOptionsHandler:</p>

<pre><code>if (object.getId() == 15621) {
    player.getWarriorsGuild().createWarrior(itemId, object);
    player.getDialogueManager().startDialogue(
         (short) 211,
         new String[] {
             "The animator hums. Something seems to be working.",
             "You stand back..." });
    return;
}
</code></pre>

<p>Now my getWarriorsGuild() Method in player.java</p>

<pre><code>public AnimationGame getWarriorsGuild() {
    return warriorsGuild;
}

public AnimationGame warriorsGuild = new AnimationGame(this);
</code></pre>

<p>and last but not least, my createWarrior method in AnimationGame.</p>

<pre><code>public void createWarrior(int armours, final WorldObject object) {
    final WarriorsArmour sets = WarriorsArmour.forId(armours);
    if (sets == null || sets.getArmour() == null) return;
    if (sets.getArmour()[0] == armours || sets.getArmour()[1] == armours
            || sets.getArmour()[2] == armours) {
        if (player.getInventory().containsItem(sets.getArmour()[0], 1)
                &amp;&amp; player.getInventory().containsItem(sets.getArmour()[1],
                        1)
                &amp;&amp; player.getInventory().containsItem(sets.getArmour()[2],
                        1)) {
            final boolean running = player.isRunning();
            player.getInventory().deleteItem(sets.getArmour()[0], 1);
            player.getInventory().deleteItem(sets.getArmour()[1], 1);
            player.getInventory().deleteItem(sets.getArmour()[2], 1);
            int newX = player.getX();
            int newY = player.getY() + 5;
            player.setRun(false);
            player.setRunHidden(false);
            player.addWalkSteps(newX, newY, -1, false);
            player.setNextAnimation(new Animation(827));
            player.addStopDelay(3L);
            player.getDialogueManager().startDialogue("WAnimator",
                    new Object[0]);
            WorldTasksManager.schedule(new WorldTask() {

                public void run() {
                    if (!secondloop) {
                        secondloop = true;
                        player.setRunHidden(running);
                    } else {
                        stop();
                    }
                }

                boolean secondloop;
            }, 0, 6);
            WorldTasksManager.schedule(new WorldTask() {

                @Override
                public void run() {
                    final NPC war = new NPC(sets.getNpcId(), new WorldTile(
                            object.getX(), object.getY(), 0), -1, true);
                    war.addWalkSteps(player.getY(), player.getY());
                    player.setNextFaceEntity(war);
                    war.setTarget(player);
                    war.setNextAnimation(new Animation(4166));
                    war.setNextForceTalk(new ForceTalk("I'M ALIVE!"));
                    player.getInterfaceManager().closeChatBoxInterface();
                    player.getInterfaceManager()
                            .closeReplacedRealChatBoxInterface();
                    player.getHintIconsManager().addHintIcon(war, 1, -1,
                            false);
                    player.sendAreaInterface(player);
                    WorldTasksManager.schedule(new WorldTask() {

                        @Override
                        public void run() {
                            war.setFinished(true);
                            war.setForceWalk(new WorldTile(-1, -1, -1));
                            World.removeNPC(war);
                            stop();
                        }

                    }, 60, 60);
                    stop();
                    return;
                }

            }, 3, 3);
        } else {
            return;
        }
        return;
    }
}
</code></pre>

<p>I would like to know, what is causing that nullpointer, as I do not understand?
If you need to see more, dont hesitate to ask, thanks :)</p>
