Fixed LGTM Issue - Dereferenced variable may be null - GCI
@@ -285,8 +285,13 @@ protected void parseSkeletalMeshData(Element rootElement) throws ColladaParseExc
if ("JOINT".equals(vertexWeightsInput.semantic)) {
md5Weight.jointIndex = index;
vertexWeightsJointNameArray[vertexWeightsIndex] = jointNameArray[index];
- // logger.debug(String.valueOf(vertexWeightsVDataIndex) + ": " + "jointName=" + vertexWeightsJointNameArray[vertexWeightsIndex]);
+ if (vertexWeightsJointNameArray[vertexWeightsIndex] == null){
+ logger.debug("No jointNameArray in index: " + index);
+ }
} else if ("WEIGHT".equals(vertexWeightsInput.semantic)) {
+ if (weightsArray == null) {
+ logger.debug("No weights in weightsArray");
+ }
md5Weight.bias = weightsArray[index];
vertexWeightsArray[vertexWeightsIndex] = weightsArray[index];
// logger.debug(String.valueOf(vertexWeightsVDataIndex) + ": " + "weight=" + vertexWeightsArray[vertexWeightsIndex]);
@@ -304,6 +309,10 @@ protected void parseSkeletalMeshData(Element rootElement) throws ColladaParseExc
// Find a node with sid="joint-name"
for (String jointName : jointNameArray) {
+ if (jointName == null)
+ {
+ throw new ColladaParseException("a jointName is null in jointNmaeArray")
+ }
MD5Joint md5Joint = md5JointBySidMap.get(jointName);
if (null == md5Joint) {
