From 35a51a9d0619ee0d6b2112ea4fe47db5100e5b16 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 26 Aug 2007 20:55:56 +0000 Subject: [PATCH] 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 --- core/page.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 ); } } }