Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make Game#setScreen accept null

  • Loading branch information...
commit 7e2443e367166f5944ae8a6c4cd8339456c55158 1 parent cb849d0
@ttencate authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 gdx/src/com/badlogic/gdx/Game.java
View
10 gdx/src/com/badlogic/gdx/Game.java
@@ -52,12 +52,16 @@ public void resize (int width, int height) {
}
/** Sets the current screen. {@link Screen#hide()} is called on any old screen, and {@link Screen#show()} is called on the new
- * screen. */
+ * screen, if any.
+ * @param screen may be {@code null}
+ */
public void setScreen (Screen screen) {
if (this.screen != null) this.screen.hide();
this.screen = screen;
- screen.show();
- screen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
+ if (this.screen != null) {
+ screen.show();
+ screen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
+ }
}
/** @return the currently active {@link Screen}. */
Please sign in to comment.
Something went wrong with that request. Please try again.