fix NPE in AndroidHarness when quitting (thanks iwgEric)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9241 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent 511a11fc7c
commit 1a771236cf
  1. 34
      engine/src/android/com/jme3/app/AndroidHarness.java

@ -230,12 +230,14 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt
view.onResume();
}
//resume the audio
AudioRenderer result = app.getAudioRenderer();
if (result != null) {
if (result instanceof AndroidAudioRenderer) {
AndroidAudioRenderer renderer = (AndroidAudioRenderer) result;
renderer.resumeAll();
if (app != null) {
//resume the audio
AudioRenderer result = app.getAudioRenderer();
if (result != null) {
if (result instanceof AndroidAudioRenderer) {
AndroidAudioRenderer renderer = (AndroidAudioRenderer) result;
renderer.resumeAll();
}
}
}
@ -250,18 +252,20 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt
view.onPause();
}
//pause the audio
AudioRenderer result = app.getAudioRenderer();
if (result != null) {
logger.log(Level.INFO, "pause: {0}", result.getClass().getSimpleName());
if (result instanceof AndroidAudioRenderer) {
AndroidAudioRenderer renderer = (AndroidAudioRenderer) result;
renderer.pauseAll();
if (app != null) {
//pause the audio
AudioRenderer result = app.getAudioRenderer();
if (result != null) {
logger.log(Level.INFO, "pause: {0}", result.getClass().getSimpleName());
if (result instanceof AndroidAudioRenderer) {
AndroidAudioRenderer renderer = (AndroidAudioRenderer) result;
renderer.pauseAll();
}
}
}
isGLThreadPaused = true;
logger.info("onPause");
}
@Override
@ -448,7 +452,7 @@ public class AndroidHarness extends Activity implements TouchListener, DialogInt
public void destroy() {
if (app != null) {
app.destroy();
}
}
if (finishOnAppStop) {
finish();
}

Loading…
Cancel
Save