]> git.lyx.org Git - features.git/commitdiff
Fix Null-checking issue detected by Coverity.
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 11 Jan 2018 12:43:35 +0000 (13:43 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 12 Jan 2018 09:31:40 +0000 (10:31 +0100)
(cherry picked from commit 974553d8583954aa7741c4dc0ce83f9ca812b03b)

src/Paragraph.cpp

index fcf4a73a8153de3a05ac41a13d218a04fccae70b..5c5a728027f3c4cd4f9201749c44334394a75fdb 100644 (file)
@@ -1436,9 +1436,6 @@ bool Paragraph::Private::latexSpecialT3(char_type const c, otexstream & os,
 
 void Paragraph::Private::validate(LaTeXFeatures & features) const
 {
-       Buffer const & buf = inset_owner_->buffer();
-       BufferParams const & bp = features.runparams().is_child
-               ? buf.masterParams() : buf.params();
        if (layout_->inpreamble && inset_owner_) {
                bool const is_command = layout_->latextype == LATEX_COMMAND;
                Font f;
@@ -1446,6 +1443,9 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
                // switching machinery of odocstream. Therefore the
                // output is wrong if this paragraph contains content
                // that needs to switch encoding.
+               Buffer const & buf = inset_owner_->buffer();
+               BufferParams const & bp = features.runparams().is_child
+                       ? buf.masterParams() : buf.params();
                otexstringstream os;
                os << layout_->preamble();
                if (is_command) {
@@ -1520,6 +1520,8 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
        }
 
        // then the contents
+       BufferParams const bp = features.runparams().is_child
+               ? features.buffer().masterParams() : features.buffer().params();
        for (pos_type i = 0; i < int(text_.size()) ; ++i) {
                char_type c = text_[i];
                if (c == 0x0022) {