From 515f9c7ac16baa8ca22ba29f1a659d0c3d058a05 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 3 Oct 2010 18:05:00 +0000 Subject: [PATCH] resolve numeric destinations of outline items pages can have identifiers made up only with numbers; this needs to be taken into account when resolving the destination of outline items, otherwise the previous algorithm would assume that a numeric destination is a page number, and thus potentially accessing to wrong pages (and crashing) svn path=/trunk/KDE/kdegraphics/okular/; revision=1182195 --- generators/djvu/kdjvu.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/generators/djvu/kdjvu.cpp b/generators/djvu/kdjvu.cpp index f2becee69..302a69b89 100644 --- a/generators/djvu/kdjvu.cpp +++ b/generators/djvu/kdjvu.cpp @@ -549,7 +549,17 @@ void KDjVu::Private::fillBookmarksRecurse( QDomDocument& maindoc, QDomNode& curn dest.toInt( &isNumber ); if ( isNumber ) { - el.setAttribute( "PageNumber", dest ); + // it might be an actual page number, but could also be a page label + // so resolve the number, and get the real page number + int pageNo = pageWithName( dest ); + if ( pageNo != -1 ) + { + el.setAttribute( "PageNumber", QString::number( pageNo + 1 ) ); + } + else + { + el.setAttribute( "PageNumber", dest ); + } } else {