diff --git a/ui/toc.cpp b/ui/toc.cpp index 5fb8e5653..9f20bcca7 100644 --- a/ui/toc.cpp +++ b/ui/toc.cpp @@ -120,7 +120,11 @@ void TOC::addChildren( const QDomNode & parentNode, KListViewItem * parentItem ) void TOC::slotExecuted( QListViewItem *i ) { - const QDomElement & e = static_cast< TOCItem* >( i )->element(); + TOCItem* tocItem = dynamic_cast( i ); + // that filters clicks on [+] that for a strange reason don't seem to be TOCItem* + if (tocItem == NULL) + return; + const QDomElement & e = tocItem->element(); if ( e.hasAttribute( "Viewport" ) ) { // if the node has a viewport, set it