eventDispatch nur nach initialisierung aufrufen

This commit is contained in:
ngb
2022-07-11 22:09:00 +02:00
parent 5557030e0d
commit 99d0e702aa

View File

@@ -194,7 +194,9 @@ public class Music implements Audio {
private void stream() { private void stream() {
audioLine.start(); audioLine.start();
playing = true; playing = true;
eventDispatcher.dispatchEvent("start", Music.this); if( eventDispatcher != null ) {
eventDispatcher.dispatchEvent("start", Music.this);
}
byte[] bytesBuffer = new byte[BUFFER_SIZE]; byte[] bytesBuffer = new byte[BUFFER_SIZE];
int bytesRead = -1; int bytesRead = -1;
@@ -221,7 +223,9 @@ public class Music implements Audio {
playing = false; playing = false;
streamingStopped(); streamingStopped();
eventDispatcher.dispatchEvent("stop", Music.this); if( eventDispatcher != null ) {
eventDispatcher.dispatchEvent("stop", Music.this);
}
} }
private boolean openLine() { private boolean openLine() {