Unable to load Picture from an app state

I have an appstate. It’s initialize() throws NullPointerException.

public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
    main = (Main) app;
    guiNode = main.getGuiNode();
    //TODO: initialize your AppState, e.g. attach spatials to rootNode
    //this is called on the OpenGL thread after the AppState has been attached
    wheelPic = new Picture("BlockWheel");
    wheelPic.setImage(assetManager, "Textures/BlockWheel.png", true); //Here the nullPointerException is thrown
    wheelPic.setPosition(-200, -200);
    wheelPivot = new Node();

By the stack trace I’m guessing that it can’t find the image. But the image is there, and the same code works in simpleInitApp().

Also, here’s the stack trace:

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
at com.jme3.ui.Picture.setImage(Picture.java:136)
at blockEngine.WheelAppState.initialize(WheelAppState.java:40)
at com.jme3.app.state.AppStateManager.initializePending(AppStateManager.java:251)
at com.jme3.app.state.AppStateManager.update(AppStateManager.java:281)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:239)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:744)

Any ideas out there?

assetManager is null.
Where does it come from?
use app.getAssetManager() instead and it should work.

Whoops, totally forgot to write that line of code :flushed: