您好,我正在向我的客户端添加声音,如果用户没有声音,则会崩溃客户端并出现此错误
Exception in thread "Thread-3" java.lang.NullPointerException
at Org.Game.Client.playMidi(Client.java:101)
at Org.Game.Client.processOnDemandQueue(Client.java:3702)
at Org.Game.Client.processGameLoop(Client.java:2959)
at Org.Game.RSApplet.run(RSApplet.java:214)
at Org.Game.Client.run(Client.java:5569)
at java.lang.Thread.run(Unknown Source)
现在我想知道我怎样才能看到用户是否有声音,以及他们是否做不到这样就绕过了这个错误
public void playMidi(byte abyte0[]) {
try {
boolean quickSong = (prevSong > 0 ? true : false);
boolean loopMusic = loop;
if(midiPlayer.playing() && !quickSong){
midiPlayer.play(abyte0, loopMusic, midiVolume);//add fading to this one
}else{
midiPlayer.play(abyte0, loopMusic, midiVolume);
}
}
}