From d4fbe62ad024083739c07b4f7c7d75037fba7a14 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Wed, 22 May 2013 14:48:22 +0100 Subject: MtpSource: prevent a freeze when dealing with Windows Phone (bgo#687495) An ArgumentNullException was raised when accessing the BytesUsed property of MtpSource class, which can be easily avoided by checking for null first. If mtp_device is null it means that its initialization has not succeded, something which should be logged by the DeviceInitialize() method. --- src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs b/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs index e7cd000b8..c3670f70f 100644 --- a/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs +++ b/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs @@ -294,7 +294,7 @@ namespace Banshee.Dap.Mtp private long bytes_used; public override long BytesUsed { get { - if (Monitor.TryEnter (mtp_device)) { + if (mtp_device != null && Monitor.TryEnter (mtp_device)) { try { bytes_used = 0; foreach (DeviceStorage s in mtp_device.GetStorage ()) { -- cgit v1.2.3