From 615c733844e604cd1e966206eaffa61d14f7bd39 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Mon, 12 Sep 2016 05:15:00 +0200 Subject: [PATCH] Make sure a pointer is valid before using it --- src/Cursor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 4e63734155..b3c1edd7a4 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1449,14 +1449,14 @@ bool Cursor::macroModeClose() else if (atom.nucleus()->nargs() > 0) atom.nucleus()->cell(0).append(selection); - if (in->currentMode() == Inset::TEXT_MODE + if (in && in->currentMode() == Inset::TEXT_MODE && atom.nucleus()->currentMode() == Inset::MATH_MODE && name != from_ascii("ensuremath")) { MathAtom at(new InsetMathEnsureMath(buffer())); at.nucleus()->cell(0).push_back(atom); niceInsert(at); posForward(); - } else if (in->currentMode() == Inset::MATH_MODE + } else if (in && in->currentMode() == Inset::MATH_MODE && atom.nucleus()->currentMode() == Inset::TEXT_MODE && name != from_ascii("text")) { MathAtom at = createInsetMath("text", buffer()); -- 2.39.2