]> git.lyx.org Git - lyx.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>
Thu, 11 Jan 2018 12:43:35 +0000 (13:43 +0100)
src/Paragraph.cpp

index fc5b94107cf17bc1012828e6341958143fa5988a..3c26bf1105a93a2e27d68841562998eb9b8adfbf 100644 (file)
@@ -1429,14 +1429,12 @@ 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_) {
                // FIXME: Using a string stream here circumvents the encoding
                // 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();
                otexstringstream os;
                os << layout_->preamble();
                size_t const length = os.length();
@@ -1490,6 +1488,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) {