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

List:       kde-commits
Subject:    kdebase/konqueror
From:       George Staikos <staikos () kde ! org>
Date:       2003-05-26 0:03:05
[Download RAW message or body]

CVS commit by staikos: 

check return value from dynamic_cast<>!

Does this fix #58666?

CCMAIL: 58666@bugs.kde.org


  M +17 -8     konq_viewmgr.cc   1.221


--- kdebase/konqueror/konq_viewmgr.cc  #1.220:1.221
@@ -520,16 +520,23 @@ void KonqViewManager::removeTab( KonqFra
 #endif
 
-  if (m_pDocContainer == 0L) return;
-  if (m_pDocContainer->frameType() != "Tabs") return;
+  if (m_pDocContainer == 0L)
+    return;
+  if (m_pDocContainer->frameType() != "Tabs")
+    return;
 
   KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(m_pDocContainer);
 
   KonqFrameBase* currentFrame;
-  if ( tab == 0L )
-    currentFrame = dynamic_cast<KonqFrameBase*>(tabContainer->currentPage());
-  else
+  if ( tab != 0L ) {
     currentFrame = tab;
+  } else {
+    currentFrame = dynamic_cast<KonqFrameBase*>(tabContainer->currentPage());
+    if (!currentFrame) {
+      return;
+    }
+  }
 
-  if (currentFrame->widget() == tabContainer->currentPage()) setActivePart( 0L, true );
+  if (currentFrame->widget() == tabContainer->currentPage())
+    setActivePart( 0L, true );
 
   tabContainer->removeChildFrame(currentFrame);
@@ -542,5 +549,6 @@ void KonqViewManager::removeTab( KonqFra
   for ( it.toFirst(); it != 0L; ++it )
   {
-    if (it.current()==m_pMainWindow->currentView()) setActivePart( 0L, true );
+    if (it.current() == m_pMainWindow->currentView())
+      setActivePart( 0L, true );
     m_pMainWindow->removeChildView( it.current() );
     delete it.current();
@@ -549,5 +557,6 @@ void KonqViewManager::removeTab( KonqFra
   delete currentFrame;
 
-  if (tabContainer->count() == 1) revertDocContainer();
+  if (tabContainer->count() == 1)
+    revertDocContainer();
 
 #ifndef NDEBUG


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

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