[LyX/master] Fix nullpointer (#12898)

Juergen Spitzmueller spitz at lyx.org
Sun Sep 10 11:31:35 UTC 2023


commit be1bf5c05c898f96e1bd95b6a65a1d8daa98e5f8
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Sep 10 14:47:59 2023 +0200

    Fix nullpointer (#12898)
    
    Also, quit method early if file does not exist
---
 src/insets/InsetGraphics.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp
index 2d93f15..dac61ee 100644
--- a/src/insets/InsetGraphics.cpp
+++ b/src/insets/InsetGraphics.cpp
@@ -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


More information about the lyx-cvs mailing list