summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres G. Aragoneses <knocte@gmail.com>2013-05-22 14:48:22 +0100
committerAndres G. Aragoneses <knocte@gmail.com>2013-05-22 14:48:22 +0100
commitd4fbe62ad024083739c07b4f7c7d75037fba7a14 (patch)
treee00fef6d0464f9d044241381647d3128784a2cab
parentf847cb0c742b2d993dad71dba373bd81bb457afa (diff)
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.
-rw-r--r--src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs2
1 files changed, 1 insertions, 1 deletions
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 ()) {