Commit 286d2989 authored by Andrés G. Aragoneses's avatar Andrés G. Aragoneses

Dap: prevent crash by checking if library was not found (bgo#614039)

As the stacktrace in comment#1 of bug#614039 shows
(https://bugzilla.gnome.org/show_bug.cgi?id=614039#c1)
it could happen that the source is not found by the
RemoveLibrary() method.

Note: this had a slightly confusing exception message
because in old versions of mono there was a bug about
this, which was fixed in mono, actually by yours truly:
https://github.com/mono/mono/commit/caf7a8b2c0b0288b19f90b1e43092d4da4083d22

This fixes the first part of bgo#614039.
parent 62eed898
......@@ -192,7 +192,12 @@ namespace Banshee.Dap
{
var library = GetSyncableLibrary (source);
if (library != null) {
var sync = library_syncs.First (s => s.Library == library);
var sync = library_syncs.FirstOrDefault (s => s.Library == library);
if (sync == null) {
return;
}
library_syncs.Remove (sync);
sync.Library.TracksAdded -= OnLibraryChanged;
sync.Library.TracksDeleted -= OnLibraryChanged;
......
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