commit c42776868db7eb13deb5d2c16d3e6a2b047318e7
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Thu Jun 18 11:39:45 2020 +0200

    Do not dereference getFormat() if it is null
    
    Return early when format is unknown. I am not sure whether this is
    supposed to happen and whether we should assert on this condition.
    
    Spotted by coverity.
---
 src/insets/InsetGraphics.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp
index a5a9ef3..68bf2c1 100644
--- a/src/insets/InsetGraphics.cpp
+++ b/src/insets/InsetGraphics.cpp
@@ -623,7 +623,10 @@ string const stripExtensionIfPossible(string const & file, 
string const & to, bo
 {
        // No conversion is needed. LaTeX can handle the graphic file as is.
        // This is true even if the orig_file is compressed.
-       string const to_format = theFormats().getFormat(to)->extension();
+       Format const * f = theFormats().getFormat(to);
+       if (!f)
+               return latex_path(file, EXCLUDE_EXTENSION);
+       string const to_format = f->extension();
        string const file_format = getExtension(file);
        // for latex .ps == .eps
        if (to_format == file_format ||
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to