Skip to content

Commit

Permalink
Fixed NPE if file failed to load.
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSweet committed Nov 24, 2014
1 parent 9cb1a28 commit e38213f
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,18 @@ public void render () {
ui.stage.draw();

// Draw indicator for timeline position.
ShapeRenderer shapes = debugRenderer.getShapeRenderer();
TrackEntry entry = state.getCurrent(0);
if (entry != null) {
float percent = entry.getTime() / entry.getEndTime();
if (entry.getLoop()) percent %= 1;
float x = ui.window.getRight() + (Gdx.graphics.getWidth() - ui.window.getRight()) * percent;
shapes.setColor(Color.CYAN);
shapes.begin(ShapeType.Line);
shapes.line(x, 0, x, 20);
shapes.end();
if (state != null) {
ShapeRenderer shapes = debugRenderer.getShapeRenderer();
TrackEntry entry = state.getCurrent(0);
if (entry != null) {
float percent = entry.getTime() / entry.getEndTime();
if (entry.getLoop()) percent %= 1;
float x = ui.window.getRight() + (Gdx.graphics.getWidth() - ui.window.getRight()) * percent;
shapes.setColor(Color.CYAN);
shapes.begin(ShapeType.Line);
shapes.line(x, 0, x, 20);
shapes.end();
}
}
}

Expand Down

0 comments on commit e38213f

Please sign in to comment.