From 3e9489d8706d17bbc2bd30bde465380cbd288ca0 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Thu, 30 Jul 2009 03:21:04 +0000 Subject: [PATCH] Avoid deferencing a null pointer. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30805 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/output_latex.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index a98ffb8c15..e62e2d77db 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -115,7 +115,8 @@ TeXEnvironment(Buffer const & buf, ParagraphList::const_iterator const priorpit = pit == paragraphs.begin() ? pit : boost::prior(pit); - bool const use_prev_env_language = priorpit->layout().isEnvironment() + bool const use_prev_env_language = prev_env_language_ != 0 + && priorpit->layout().isEnvironment() && (priorpit->getDepth() > pit->getDepth() || (priorpit->getDepth() == pit->getDepth() && priorpit->layout() != pit->layout())); @@ -352,7 +353,8 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf, // environment with nesting depth greater than (or equal to, but with // a different layout) the current one. If there is no previous // paragraph, the previous language is the outer language. - bool const use_prev_env_language = priorpit->layout().isEnvironment() + bool const use_prev_env_language = prev_env_language_ != 0 + && priorpit->layout().isEnvironment() && (priorpit->getDepth() > pit->getDepth() || (priorpit->getDepth() == pit->getDepth() && priorpit->layout() != pit->layout()));