Merge pull request #505 from JavaSaBr/v3.1

fixed the NPE with controls, thanks to JavaSaBr
cleanup_build_scripts
empirephoenix 8 years ago committed by GitHub
commit 7eb9463496
  1. 11
      jme3-core/src/main/java/com/jme3/scene/Spatial.java

@ -55,6 +55,7 @@ import com.jme3.util.SafeArrayList;
import com.jme3.util.TempVars; import com.jme3.util.TempVars;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
@ -1637,6 +1638,16 @@ public abstract class Spatial implements Savable, Cloneable, Collidable, Cloneab
//controls = ic.readSavableArrayList("controlsList", null)); //controls = ic.readSavableArrayList("controlsList", null));
controls.addAll(0, ic.readSavableArrayList("controlsList", null)); controls.addAll(0, ic.readSavableArrayList("controlsList", null));
// remove all controls which wasn't loaded.
if(controls.contains(null)) {
logger.log(Level.WARNING, "This spatial has problems with loading controls.", this);
for (Iterator<Control> iterator = controls.iterator(); iterator.hasNext(); ) {
final Control control = iterator.next();
if(control == null) iterator.remove();
}
}
userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null); userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null);
} }

Loading…
Cancel
Save