소스 검색

Made the app-states taking constructor more defensive
so that it can be called with null in various ways
without throwing NPEs.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9167 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

PSp..om 13 년 전
부모
커밋
72561e7a8b
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7 2
      engine/src/core/com/jme3/app/SimpleApplication.java

+ 7 - 2
engine/src/core/com/jme3/app/SimpleApplication.java

@@ -102,8 +102,13 @@ public abstract class SimpleApplication extends Application {
 
     public SimpleApplication( AppState... initialStates ) {
         super();
-        for (AppState a : initialStates) {
-            stateManager.attach(a);
+        
+        if (initialStates != null) {
+            for (AppState a : initialStates) {
+                if (a != null) {
+                    stateManager.attach(a);
+                }
+            }
         }
     }