Skip to content

Commit 18fa6be

Browse files
authored
solve issue #1937 (NPE in FbxObject) (#1938)
1 parent 08d6984 commit 18fa6be

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/FbxLoader.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009-2021 jMonkeyEngine
2+
* Copyright (c) 2009-2023 jMonkeyEngine
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without
@@ -257,8 +257,23 @@ private void connectObjects(FbxElement element) {
257257
parentId = FbxId.create(el.properties.get(2));
258258
String propName = (String) el.properties.get(3);
259259
FbxObject child = objectMap.get(childId);
260+
if (child == null) {
261+
logger.log(Level.WARNING,
262+
"Missing child object with ID {0}. Skipping object-"
263+
+ "property connection for property \"{1}\"",
264+
new Object[]{childId, propName});
265+
}
260266
FbxObject parent = objectMap.get(parentId);
261-
parent.connectObjectProperty(child, propName);
267+
if (parent == null) {
268+
logger.log(Level.WARNING,
269+
"Missing parent object with ID {0}. Skipping object-"
270+
+ "property connection for property \"{1}\"",
271+
new Object[]{parentId, propName});
272+
}
273+
if (parent != null && child != null) {
274+
parent.connectObjectProperty(child, propName);
275+
}
276+
262277
} else {
263278
logger.log(Level.WARNING, "Unknown connection type: {0}. Ignoring.", type);
264279
}

0 commit comments

Comments
 (0)