[banshee/stable-2.6] MtpSource: prevent a crash when dealing with Nexus4 (bgo#722947)



commit ff87565bd85f5e2e97802033bb3c8974df61aabd
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Sat Jan 25 03:13:38 2014 +0100

    MtpSource: prevent a crash when dealing with Nexus4 (bgo#722947)
    
    Similar fix to this recent one[1], but which I managed to
    reproduce with a Nexus4.
    
    [1] https://git.gnome.org/browse/banshee/commit/?h=stable-2.6&id=4f69e71970a9db3b8e5930fc6af06718cabc11e4

 .../Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs   |    2 +-
 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 a9da82d..cda0ae6 100644
--- a/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
+++ b/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
@@ -311,7 +311,7 @@ namespace Banshee.Dap.Mtp
         private long bytes_capacity;
         public override long BytesCapacity {
             get {
-                if (Monitor.TryEnter (mtp_device)) {
+                if (mtp_device != null && Monitor.TryEnter (mtp_device)) {
                     try {
                         bytes_capacity = 0;
                         foreach (DeviceStorage s in mtp_device.GetStorage ()) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]