Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

buildTo(Locatable a).step() will throw an NPE sometimes

Joined
Nov 18, 2013
Messages
120
When I run this code it sometimes throws an NPE and I can't figure out why

Code:
 GameObject obelisk = GameObjects.newQuery().names("Small obelisk").results().first();
        if (obelisk != null && !obelisk.isVisible()) {
            Traversal.getDefaultWeb().getPathBuilder().buildTo(obelisk.getPosition()).step();
            Camera.passivelyTurnTo(obelisk);
        }
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
You're not null checking your path. If a path can't be generated it'll return null.
 
Top