[Bug 81579] Crash using shortcut for Add Method...

Jens Dagerbo jens.dagerbo at swipnet.se
Wed May 19 18:51:02 UTC 2004


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
      
http://bugs.kde.org/show_bug.cgi?id=81579      




------- Additional Comments From jens.dagerbo swipnet se  2004-05-19 18:50 -------
CVS commit by dagerbo: 

BACKPORT

Don't crash when user attempts "add method" without selecting a class 
(this is possible through the use of keyboard shortcuts)

CCMAIL: 81579 bugs kde org


  M +8 -2      classviewwidget.cpp   1.48.2.1


--- kdevelop/parts/classview/classviewwidget.cpp  #1.48:1.48.2.1
 @ -895,4 +895,6  @ void ClassViewWidget::slotNewClass( )
 void ClassViewWidget::slotAddMethod( )
 {
+    if ( !selectedItem() ) return;
+
     if( m_part->languageSupport()->features() & KDevLanguageSupport::AddMethod )
         m_part->languageSupport()->addMethod( static_cast<ClassDomBrowserItem*>( selectedItem() )->dom() );
 @ -901,4 +903,6  @ void ClassViewWidget::slotAddMethod( )
 void ClassViewWidget::slotAddAttribute( )
 {
+    if ( !selectedItem() ) return;
+    
     if( m_part->languageSupport()->features() & KDevLanguageSupport::AddAttribute )
         m_part->languageSupport()->addAttribute( static_cast<ClassDomBrowserItem*>( selectedItem() )->dom() );
 @ -907,4 +911,6  @ void ClassViewWidget::slotAddAttribute( 
 void ClassViewWidget::slotOpenDeclaration( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast<ClassViewItem*>( selectedItem() )->openDeclaration();
 }
 @ -912,4 +918,6  @ void ClassViewWidget::slotOpenDeclaratio
 void ClassViewWidget::slotOpenImplementation( )
 {
+    if ( !selectedItem() ) return;
+    
     static_cast<ClassViewItem*>( selectedItem() )->openImplementation();
 }
 @ -940,6 +948,4  @ bool FunctionDomBrowserItem::hasImplemen
 void ClassViewWidget::maybeTip( QPoint const & p )
 {
-        kdDebug(0) << "ClassViewWidget::maybeTip()" << endl;
-
         ClassViewItem * item = dynamic_cast<ClassViewItem*>( itemAt( p ) );
         if ( !item ) return;




More information about the KDevelop-devel mailing list