Skip to content

Commit

Permalink
Fixed WifiLock under-locked exception. Fixed OutOfMemoryError with la…
Browse files Browse the repository at this point in the history
…rge album art.
  • Loading branch information
jmartine2 committed Oct 12, 2016
1 parent 27befb0 commit bca6696
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions MediaManager/Plugin.MediaManager.Android/MediaPlayerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,16 @@ public async Task Play()
Cover = await BitmapFactory.DecodeResourceAsync(Resources, Resource.Drawable.ButtonStar);
}
else
Cover = await BitmapFactory.DecodeByteArrayAsync(imageByteArray, 0, imageByteArray.Length);
{
try
{
Cover = await BitmapFactory.DecodeByteArrayAsync(imageByteArray, 0, imageByteArray.Length);
}
catch (Java.Lang.OutOfMemoryError)
{
Cover = null;
}
}
StartedPlayback = true;
}
catch (Exception ex)
Expand Down Expand Up @@ -934,7 +943,13 @@ private void ReleaseWifiLock()
if (wifiLock == null || !wifiLock.IsHeld)
return;

wifiLock.Release();
try
{
wifiLock.Release();
}
catch (Java.Lang.RuntimeException)
{ }

wifiLock = null;
}

Expand Down

0 comments on commit bca6696

Please sign in to comment.