[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [amarok] src/core-impl/collections/umscollection: Prevent crash when uninitialized.
From:       Bart Cerneels <bart.cerneels () kde ! org>
Date:       2012-01-25 13:29:27
Message-ID: 20120125132927.0247CA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit d15e0c1e19e3f569e770e3e71ab9934bfa4d61e6 by Bart Cerneels.
Committed on 25/01/2012 at 13:54.
Pushed by shanachie into branch 'master'.

Prevent crash when uninitialized.

BUG:292392
FIXED_In:2.6

M  +9    -1    src/core-impl/collections/umscollection/UmsCollection.cpp

http://commits.kde.org/amarok/d15e0c1e19e3f569e770e3e71ab9934bfa4d61e6

diff --git a/src/core-impl/collections/umscollection/UmsCollection.cpp \
b/src/core-impl/collections/umscollection/UmsCollection.cpp index d39be23..337cad8 \
                100644
--- a/src/core-impl/collections/umscollection/UmsCollection.cpp
+++ b/src/core-impl/collections/umscollection/UmsCollection.cpp
@@ -285,7 +285,7 @@ UmsCollection::init()
         }
     }
 
-    m_mc =  QSharedPointer<MemoryCollection>(new MemoryCollection());
+    m_mc = QSharedPointer<MemoryCollection>(new MemoryCollection());
 
     m_initialized = true;
 
@@ -305,6 +305,10 @@ UmsCollection::deInit()
 bool
 UmsCollection::possiblyContainsTrack( const KUrl &url ) const
 {
+    //not initialized yet.
+    if( m_mc.isNull() )
+        return false;
+
     QString u = QUrl::fromPercentEncoding( url.url().toUtf8() );
     return u.startsWith( m_mountPoint ) || u.startsWith( "file://" + m_mountPoint );
 }
@@ -312,6 +316,10 @@ UmsCollection::possiblyContainsTrack( const KUrl &url ) const
 Meta::TrackPtr
 UmsCollection::trackForUrl( const KUrl &url )
 {
+    //not initialized yet.
+    if( m_mc.isNull() )
+        return Meta::TrackPtr();
+
     QString uid = QUrl::fromPercentEncoding( url.url().toUtf8() );
     if( uid.startsWith("file://") )
         uid = uid.remove( 0, 7 );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic