Browse Source

fixes issue https://github.com/jMonkeyEngine/jmonkeyengine/issues/506 : Material->toString() does not prevent/check for possible NPEs

jjYBdx4IL 9 years ago
parent
commit
a20a84cf42
1 changed files with 2 additions and 2 deletions
  1. 2 2
      jme3-core/src/main/java/com/jme3/material/Material.java

+ 2 - 2
jme3-core/src/main/java/com/jme3/material/Material.java

@@ -992,8 +992,8 @@ public class Material implements CloneableSmartAsset, Cloneable, Savable {
     @Override
     @Override
     public String toString() {
     public String toString() {
         return "Material[name=" + name + 
         return "Material[name=" + name + 
-                ", def=" + def.getName() + 
-                ", tech=" + technique.getDef().getName() + 
+                ", def=" + (def != null ? def.getName() : null) + 
+                ", tech=" + (technique != null && technique.getDef() != null ? technique.getDef().getName() : null) + 
                 "]";
                 "]";
     }
     }