fix(audio): skip update when player is invalid (#4779)

develop
Michael Pollind 2021-06-20 04:50:59 -07:00 committed by GitHub
parent 8aa631f77b
commit 6f5bf08201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -112,9 +112,13 @@ public class AudioSystem extends BaseComponentSystem implements UpdateSubscriber
@Override
public void update(float delta) {
if (!localPlayer.isValid()) {
// localplayer is invalid so no audio
return;
}
audioManager.updateListener(
localPlayer.getPosition(playerPosition),
localPlayer.getViewRotation(playerViewRotation),
localPlayer.getVelocity(playerVelocity));
localPlayer.getPosition(playerPosition),
localPlayer.getViewRotation(playerViewRotation),
localPlayer.getVelocity(playerVelocity));
}
}