Commit 50bf3cc1 authored by Andrés G. Aragoneses's avatar Andrés G. Aragoneses

Mtp: fix NullReferenceException if playlistFolder wasn't found (bgo#733883)

There was already a way to try to prevent a NULL playlistFolder
in the MtpDevice class, but it was insufficient in my case. I'm
using a Nexus7, and in this case 'device.default_playlist_folder'
was not 0, but 4294967295 (which apparently is uint.MaxValue).

However, rather than adding yet another magic number in this if
statement, checking for a NULL playlistFolder at the end of the
foreach loop seems like a more robust approach.
parent 33a6f76d
......@@ -152,10 +152,6 @@ namespace Mtp
albumFolder = f;
else if (f.FolderId == device.default_music_folder) {
musicFolder = f;
// Fix for devices that don't have an explicit playlist folder (BGO #590342)
if (device.default_playlist_folder == 0) {
playlistFolder = f;
}
}
else if (f.FolderId == device.default_organizer_folder)
organizerFolder = f;
......@@ -170,6 +166,11 @@ namespace Mtp
else if (f.FolderId == device.default_zencast_folder)
podcastFolder = f;
}
// Fix for devices that don't have an explicit playlist folder (see BGO #590342 and #733883)
if (playlistFolder == null && musicFolder != null) {
playlistFolder = musicFolder;
}
}
public void Dispose ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment