Version: (using Devel) Installed from: Compiled sources When a cbz/cbr file contains zero image files the generator in the Okular core is undefined causing this crash: #0 0x00007f4efe9e5b0a in Okular::Document::openDocument (this=0x1c1ba00, docFile=@0x7fff12f1b7b0, url=<value optimized out>, _mime=<value optimized out>) at ../../okular/core/document.cpp:1663 #1 0x00007f4efbb018b0 in Part::openFile (this=0x1b80420) at ../../okular/part.cpp:874 #2 0x00007f4f0298af34 in KParts::ReadOnlyPart::openUrl (this=0x1b80420, url=<value optimized out>) at ../../kparts/part.cpp:558 Patch for the Comicbook generator. Or maybe the fix should go instead inside Okular for 0 pages opened documents. Index: document.cpp =================================================================== --- document.cpp (revisión: 900827) +++ document.cpp (copia de trabajo) @@ -105,7 +105,7 @@ return false; } - return true; + return mPageMap.size() > 0; } void Document::close() Testcase is the attachment in the next message
Created attachment 29853 [details] testcase Open in Okular crash.cbz
Can reproduce. Seems we should protect against this in core: --- okular/core/document.cpp (revision 903994) +++ okular/core/document.cpp (working copy) @@ -1660,6 +1660,9 @@ AudioPlayer::instance()->d->m_currentDocument = isstdin ? KUrl() : d->m_url; d->m_docSize = document_size; + if ( !d->m_generator ) + return false; + const QStringList docScripts = d->m_generator->metaData( "DocumentScripts", "JavaScript" ).toStringList(); if ( !docScripts.isEmpty() ) {
D'oh, I put a protection against empty documents in the core, but forgot to actual set that the loading fails in that case. Fix coming in a minute.
SVN commit 904821 by pino: When the loaded document is empty, consider its loading as failed. (Added a TODO for a proper UI message.) BUG: 179447 M +4 -0 document.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=904821
KDE 4.1.x is not affected, as this slipped in with a small refactoring of the loading routines (shame on me). Thanks for the bug report and the test case!