[LyX/master] Avoid null pointer dereference

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sun Feb 20 15:50:46 UTC 2022


commit b365a471124d63017beabeb5c3ae84ce00c7f350
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sun Feb 20 17:22:07 2022 +0100

    Avoid null pointer dereference
    
    Spotted by coverity. In the real world, getInset should never return
    nullptr when isInset is true.
---
 src/Paragraph.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 3a4c399..9a1171f 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -2367,8 +2367,8 @@ int Paragraph::Private::startTeXParParams(BufferParams const & bparams,
 	    && !layout_->pass_thru
 	    && curAlign != LYX_ALIGN_CENTER) {
 		if (!owner_->empty()
-		    && (owner_->isInset(0)
-			&& owner_->getInset(0)->lyxCode() == VSPACE_CODE))
+		    && owner_->getInset(0)
+		    && owner_->getInset(0)->lyxCode() == VSPACE_CODE)
 			// If the paragraph starts with a vspace, the \\noindent
 			// needs to come after that (as it leaves vmode).
 			// If the paragraph consists only of the vspace,


More information about the lyx-cvs mailing list