Bugfix: Fixed NullReferenceException when search returned 0 results
This commit is contained in:
1 parent
4e132f5b1f
commit
4d52cf8263
1 file changed
+14
-11
@@ -198,18 +198,21 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
|
|
||||||
private void UpdateLength(CSong song)
|
private void UpdateLength(CSong song)
|
||||||
{
|
{
|
||||||
float time = CBase.Sound.GetLength(_PreviewSongStream);
|
if (song != null)
|
||||||
if (Math.Abs(song.Finish) > 0.001)
|
|
||||||
time = song.Finish;
|
|
||||||
|
|
||||||
// The audiobackend is not yet ready to return the length
|
|
||||||
if (time > 0)
|
|
||||||
{
|
{
|
||||||
time -= song.Start;
|
float time = CBase.Sound.GetLength(_PreviewSongStream);
|
||||||
var min = (int)Math.Floor(time / 60f);
|
if (Math.Abs(song.Finish) > 0.001)
|
||||||
var sec = (int)(time - min * 60f);
|
time = song.Finish;
|
||||||
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
|
|
||||||
_Length = time;
|
// The audiobackend is not yet ready to return the length
|
||||||
|
if (time > 0)
|
||||||
|
{
|
||||||
|
time -= song.Start;
|
||||||
|
var min = (int)Math.Floor(time / 60f);
|
||||||
|
var sec = (int)(time - min * 60f);
|
||||||
|
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
|
||||||
|
_Length = time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user