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

List:       kde-commits
Subject:    [Amarok] 8ba91b2: Fix cover dialog crash when pressing Ok when nothi
From:       "Rick W.Chen" <stuffcorpse () archlinux ! us>
Date:       2010-11-30 21:35:58
Message-ID: 20101130213558.DCF81A60B4 () git ! kde ! org
[Download RAW message or body]

commit 8ba91b250e0c36e6da3a4e9e1aa26b12dabf0de0
branch master
Author: Rick W. Chen <stuffcorpse@archlinux.us>
Date:   Wed Dec 1 10:12:55 2010 +1300

    Fix cover dialog crash when pressing Ok when nothing is selected
    
    BUG:258187

diff --git a/ChangeLog b/ChangeLog
index 97e9661..581f47f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -74,6 +74,7 @@ VERSION 2.4-Beta 1
       pressing SHIFT while clicking the action will bypass trash.
 
   BUGFIXES:
+    * Fixed cover dialog crash pressing Ok when nothing is selected. (BR 258187)
     * Title labels incorrectly used the text color from the plasma theme.
       This caused trouble with the fixed plasma theme and light color schemes.
     * Fixed a data-loss bug where the user could lose changes he made to the current
diff --git a/src/covermanager/CoverFoundDialog.cpp b/src/covermanager/CoverFoundDialog.cpp
index 36f83cb..e92946e 100644
--- a/src/covermanager/CoverFoundDialog.cpp
+++ b/src/covermanager/CoverFoundDialog.cpp
@@ -423,7 +423,12 @@ void CoverFoundDialog::slotButtonClicked( int button )
 {
     if( button == KDialog::Ok )
     {
-        CoverFoundItem *item = static_cast< CoverFoundItem* >( m_view->currentItem() );
+        CoverFoundItem *item = dynamic_cast< CoverFoundItem* >( m_view->currentItem() );
+        if( !item )
+        {
+            reject();
+            return;
+        }
 
         bool gotBigPix( true );
         if( !item->hasBigPix() )
[prev in list] [next in list] [prev in thread] [next in thread] 

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