]> git.lyx.org Git - features.git/commitdiff
If we cannot find the input format for a graphic, we cannot convert it.
authorRichard Heck <rgheck@lyx.org>
Sun, 31 Jul 2016 01:51:25 +0000 (21:51 -0400)
committerRichard Heck <rgheck@lyx.org>
Sun, 31 Jul 2016 01:58:59 +0000 (21:58 -0400)
Also includes some minor code cleanup.

(cherry picked from commit e1f597e3da26865cb01eab5bef6ad5d9e862ff7a)

src/insets/InsetGraphics.cpp

index 323eaacd6b2966236ac7b4fe040de057d25c1bbd..04faae74a4481e0cad4fcacc445ee6950ef7e4fc 100644 (file)
@@ -873,15 +873,13 @@ string InsetGraphics::prepareHTMLFile(OutputParams const & runparams) const
        if (params().filename.empty())
                return string();
 
-       string const orig_file = params().filename.absFileName();
+       if (!params().filename.isReadableFile())
+               return string();
 
        // The master buffer. This is useful when there are multiple levels
        // of include files
        Buffer const * masterBuffer = buffer().masterBuffer();
 
-       if (!params().filename.isReadableFile())
-               return string();
-
        // We place all temporary files in the master buffer's temp dir.
        // This is possible because we use mangled file names.
        // FIXME We may want to put these files in some special temporary
@@ -897,14 +895,16 @@ string InsetGraphics::prepareHTMLFile(OutputParams const & runparams) const
        if (status == FAILURE)
                return string();
 
-       string output_file = onlyFileName(temp_file.absFileName());
-
        string const from = formats.getFormatFromFile(temp_file);
-       if (from.empty())
+       if (from.empty()) {
                LYXERR(Debug::GRAPHICS, "\tCould not get file format.");
+               return string();
+       }
 
        string const to   = findTargetFormat(from, runparams);
        string const ext  = formats.extension(to);
+       string const orig_file = params().filename.absFileName();
+       string output_file = onlyFileName(temp_file.absFileName());
        LYXERR(Debug::GRAPHICS, "\t we have: from " << from << " to " << to);
        LYXERR(Debug::GRAPHICS, "\tthe orig file is: " << orig_file);