check for the data pointer, not for the size

this way we can load resources of 0 bytes (not much useful per-se, but at least we know they are actually existing in the epub archive)

svn path=/trunk/KDE/kdegraphics/okular/; revision=1182899
remotes/origin/KDE/4.6
Pino Toscano 16 years ago
parent b10baf2d19
commit 0f08bfbcf0
  1. 2
      generators/epub/converter.cpp
  2. 2
      generators/epub/epubdocument.cpp

@ -190,7 +190,7 @@ QTextDocument* Converter::convert( const QString &fileName )
} else { // load missing resource
char *data;
int size = epub_get_data(mTextDocument->getEpub(), clink, &data);
if (size > 0) {
if (data) {
_cursor->insertBlock();
// try to load as image and if not load as html

@ -61,7 +61,7 @@ QVariant EpubDocument::loadResource(int type, const QUrl &name)
QVariant resource;
if (size > 0) {
if (data) {
switch(type) {
case QTextDocument::ImageResource:
resource.setValue(QImage::fromData((unsigned char *)data, size));

Loading…
Cancel
Save