Fix crashes

This commit is contained in:
2015-11-02 22:27:08 +01:00
parent f07b9e0fdb
commit 9fb8550dbf
+2 -2
View File
@@ -128,7 +128,7 @@ namespace MusicPlayer
catch(Exception e) catch(Exception e)
{ {
AState = AudioState.STOPPED; AState = AudioState.STOPPED;
main.form.SongFinished(); //main.form.SongFinished();
return; return;
} }
@@ -141,7 +141,7 @@ namespace MusicPlayer
waveOut.Init(blockAlignedStream); waveOut.Init(blockAlignedStream);
waveOut.Play(); waveOut.Play();
if (CurrentSong.Seconds == 0) if (CurrentSong == null || CurrentSong.Seconds == 0)
Length = ms.Length / waveOut.OutputWaveFormat.AverageBytesPerSecond; Length = ms.Length / waveOut.OutputWaveFormat.AverageBytesPerSecond;
else else
Length = CurrentSong.Seconds * waveOut.OutputWaveFormat.AverageBytesPerSecond; Length = CurrentSong.Seconds * waveOut.OutputWaveFormat.AverageBytesPerSecond;