]> git.lyx.org Git - features.git/commitdiff
Fix nullpointer (#12898)
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 10 Sep 2023 12:47:59 +0000 (14:47 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 10 Sep 2023 12:47:59 +0000 (14:47 +0200)
Also, quit method early if file does not exist

src/insets/InsetGraphics.cpp

index 2d93f157fbb975d9a5d1aaa16f44b63c4a930a6c..dac61ee449d7514f635fe9042da48e3c0ff8ea3f 100644 (file)
@@ -321,13 +321,17 @@ void InsetGraphics::outBoundingBox(graphics::BoundingBox & bbox) const
 
        FileName const file(params().filename.absFileName());
 
+       if (!file.exists())
+               return;
+
        // No correction is necessary for a vector image
        bool const zipped = theFormats().isZippedFile(file);
        FileName const unzipped_file = zipped ? unzipFile(file) : file;
        string const format = theFormats().getFormatFromFile(unzipped_file);
        if (zipped)
                unzipped_file.removeFile();
-       if (theFormats().getFormat(format)->vectorFormat())
+       if (theFormats().getFormat(format)
+           && theFormats().getFormat(format)->vectorFormat())
                return;
 
        // Get the actual image dimensions in pixels