]> git.lyx.org Git - features.git/commitdiff
Avoid crashes in case of missing document buffer for buffer based conversions.
authorStephan Witt <switt@lyx.org>
Tue, 18 Feb 2020 07:43:22 +0000 (08:43 +0100)
committerStephan Witt <switt@lyx.org>
Tue, 18 Feb 2020 07:43:22 +0000 (08:43 +0100)
src/Converter.cpp

index d5686f666da5a6a2152b7188333d0137ad2e97f8..a64d7472a7b103d15425b20fea6531b42402794b 100644 (file)
@@ -586,7 +586,7 @@ Converters::RetVal Converters::convert(Buffer const * buffer,
 
                if (conv.latex()) {
                        // We are not importing, we have a buffer
-                       LATTEST(buffer);
+                       LASSERT(buffer, return FAILURE);
                        run_latex = true;
                        string command = conv.command();
                        command = subst(command, token_from, "");
@@ -604,7 +604,7 @@ Converters::RetVal Converters::convert(Buffer const * buffer,
                } else {
                        if (conv.need_aux() && !run_latex) {
                                // We are not importing, we have a buffer
-                               LATTEST(buffer);
+                               LASSERT(buffer, return FAILURE);
                                string command;
                                switch (runparams.flavor) {
                                case OutputParams::DVILUATEX:
@@ -713,8 +713,8 @@ Converters::RetVal Converters::convert(Buffer const * buffer,
                                                " > " + quoteName(logfile);
                                        res = one.startscript(starttype,
                                                to_filesystem8bit(from_utf8(command2)),
-                                               buffer->filePath(),
-                                               buffer->layoutPos());
+                                               buffer ? buffer->filePath() : string(),
+                                               buffer ? buffer->layoutPos() : string());
                                        if (res == Systemcall::KILLED) {
                                                frontend::Alert::warning(
                                                        _("Converter killed"),
@@ -722,7 +722,7 @@ Converters::RetVal Converters::convert(Buffer const * buffer,
                                                                from_utf8(command)));
                                                return KILLED;
                                        }
-                                       if (!scanLog(*buffer, command, makeAbsPath(logfile, path), errorList))
+                                       if (buffer && !scanLog(*buffer, command, makeAbsPath(logfile, path), errorList))
                                                return FAILURE;
                                }
                        }