Skip to content

Commit 1cab548

Browse files
committed
Fix: add check because tween can be null if a music is set in the tween cb.
1 parent e90fdfa commit 1cab548

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

blade-engine/src/com/bladecoder/engine/model/MusicManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class MusicManager implements Serializable, AssetConsumer {
3333
private float musicPosSer = 0;
3434
transient private boolean isPaused = false;
3535
private MusicVolumeTween volumeTween;
36-
36+
3737
// the global configurable by user volume
3838
public static float VOLUME_MULTIPLIER = 1f;
3939

@@ -177,7 +177,8 @@ public void update(float delta) {
177177

178178
if (volumeTween != null) {
179179
volumeTween.update(delta);
180-
if (volumeTween.isComplete()) {
180+
181+
if (volumeTween != null && volumeTween.isComplete()) {
181182
volumeTween = null;
182183
}
183184
}
@@ -255,7 +256,7 @@ public void read(Json json, JsonValue jsonData) {
255256
musicPosSer = json.readValue("musicPos", float.class, jsonData);
256257

257258
volumeTween = json.readValue("volumeTween", MusicVolumeTween.class, jsonData);
258-
if(volumeTween != null) {
259+
if (volumeTween != null) {
259260
volumeTween.setTarget(this);
260261
}
261262
}

0 commit comments

Comments
 (0)