stupid me, don't increment the end() iterator ;(

also, check that the index in the local save file refers to an existent form field

svn path=/trunk/KDE/kdegraphics/okular/; revision=705003
remotes/origin/KDE/4.0
Pino Toscano 19 years ago
parent e147022703
commit 35a51a9d06
  1. 8
      core/page.cpp

@ -702,7 +702,7 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
{ {
QHash<int, FormField*> hashedforms; QHash<int, FormField*> hashedforms;
QLinkedList< FormField * >::const_iterator fIt = formfields.begin(), fItEnd = formfields.end(); QLinkedList< FormField * >::const_iterator fIt = formfields.begin(), fItEnd = formfields.end();
for ( ; fIt != fItEnd; ++fItEnd ) for ( ; fIt != fItEnd; ++fIt )
{ {
hashedforms[(*fIt)->id()] = (*fIt); hashedforms[(*fIt)->id()] = (*fIt);
} }
@ -723,8 +723,12 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
if ( !ok ) if ( !ok )
continue; continue;
QHash<int, FormField*>::const_iterator wantedIt = hashedforms.find( index );
if ( wantedIt == hashedforms.end() )
continue;
QString value = formElement.attribute( "value" ); QString value = formElement.attribute( "value" );
hashedforms[index]->d_ptr->setValue( value ); (*wantedIt)->d_ptr->setValue( value );
} }
} }
} }

Loading…
Cancel
Save