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