From 2bde71b08a3d6d4e96faabfc41601152e1860938 Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Mon, 5 Mar 2012 19:22:33 +0000 Subject: [PATCH] Early out on initializePending and terminatePending if the array is empty. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9233 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/app/state/AppStateManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine/src/core/com/jme3/app/state/AppStateManager.java b/engine/src/core/com/jme3/app/state/AppStateManager.java index 81228af15..92a00f553 100644 --- a/engine/src/core/com/jme3/app/state/AppStateManager.java +++ b/engine/src/core/com/jme3/app/state/AppStateManager.java @@ -202,6 +202,9 @@ public class AppStateManager { protected void initializePending(){ AppState[] array = getInitializing(); + if (array.length == 0) + return; + synchronized( states ) { // Move the states that will be initialized // into the active array. In all but one case the @@ -219,6 +222,9 @@ public class AppStateManager { protected void terminatePending(){ AppState[] array = getTerminating(); + if (array.length == 0) + return; + for (AppState state : array) { state.cleanup(); }