add more checks against invalid viewports

fix crash when activating some of the toc items in the testcase of #176513 (still it would be nice to know why they are "void" items"...)

svn path=/trunk/KDE/kdegraphics/okular/; revision=890803
This commit is contained in:
Pino Toscano 2008-11-30 11:28:08 +00:00
parent 52a666f073
commit 769a70956f
2 changed files with 7 additions and 1 deletions

View file

@ -2370,6 +2370,12 @@ void Document::setViewportPage( int page, int excludeId, bool smoothMove )
void Document::setViewport( const DocumentViewport & viewport, int excludeId, bool smoothMove )
{
if ( !viewport.isValid() )
{
kDebug(OkularDebug) << "invalid viewport:" << viewport.toString();
return;
}
// if already broadcasted, don't redo it
DocumentViewport & oldViewport = *d->m_viewportIterator;
// disabled by enrico on 2005-03-18 (less debug output)

View file

@ -112,7 +112,7 @@ void TOC::slotExecuted( const QModelIndex &index )
Okular::GotoAction action( externalFileName, viewport );
m_document->processAction( &action );
}
else
else if ( viewport.isValid() )
{
m_document->setViewport( viewport );
}