Skip to content

GltfLoader sourceIndex NPE on SheenWoodLeatherSofa model #2385

Open
@stephengold

Description

@stephengold

SheenWoodLeatherSofa.gltf was added to the glTF-Sample-Assets test suite in May 2024.
https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/SheenWoodLeatherSofa

When I try to load it using jme3-plugins, I get warnings followed by a crash:

Mar 05, 2025 11:05:51 AM com.jme3.scene.plugins.gltf.CustomContentManager readExtension
WARNING: Could not find loader for extension KHR_materials_sheen
Mar 05, 2025 11:05:51 AM com.jme3.scene.plugins.gltf.CustomContentManager readExtension
WARNING: Could not find loader for extension KHR_materials_specular
com.jme3.asset.AssetLoadException: An error occurred loading SheenWoodLeatherSofa/glTF/SheenWoodLeatherSofa.gltf
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:181)
	at com.jme3.scene.plugins.gltf.GltfLoader.load(GltfLoader.java:107)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:274)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:390)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:441)
	at com.github.stephengold.wrench.test.CompareLoaders.loadModel(CompareLoaders.java:889)
	at com.github.stephengold.wrench.test.CompareLoaders.loadModel(CompareLoaders.java:855)
	at com.github.stephengold.wrench.test.CompareLoaders.onAction(CompareLoaders.java:496)
	at jme3utilities.ui.DefaultInputMode.onAction(DefaultInputMode.java:186)
	at com.jme3.input.InputManager.invokeActions(InputManager.java:174)
	at com.jme3.input.InputManager.onKeyEventQueued(InputManager.java:474)
	at com.jme3.input.InputManager.processQueue(InputManager.java:871)
	at com.jme3.input.InputManager.update(InputManager.java:923)
	at com.jme3.app.LegacyApplication.update(LegacyApplication.java:810)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:249)
	at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:707)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:797)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because "sourceIndex" is null
	at com.jme3.scene.plugins.gltf.GltfLoader.readTexture(GltfLoader.java:759)
	at com.jme3.scene.plugins.gltf.GltfLoader.readTexture(GltfLoader.java:739)
	at com.jme3.scene.plugins.gltf.GltfLoader.readMaterial(GltfLoader.java:650)
	at com.jme3.scene.plugins.gltf.GltfLoader.readMeshPrimitives(GltfLoader.java:473)
	at com.jme3.scene.plugins.gltf.GltfLoader.readNode(GltfLoader.java:252)
	at com.jme3.scene.plugins.gltf.GltfLoader.readChild(GltfLoader.java:301)
	at com.jme3.scene.plugins.gltf.GltfLoader.readScenes(GltfLoader.java:218)
	at com.jme3.scene.plugins.gltf.GltfLoader.loadFromStream(GltfLoader.java:155)
	... 17 more

I discovered this issue while testing JME v3.8.0-alpha4. However, the behavior hasn't changed since at least JME v3.2.4-stable, so I don't consider this a regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions