]> git.lyx.org Git - features.git/commitdiff
Make sure a pointer is valid before using it
authorEnrico Forestieri <forenr@lyx.org>
Mon, 12 Sep 2016 03:15:00 +0000 (05:15 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 12 Sep 2016 03:15:00 +0000 (05:15 +0200)
src/Cursor.cpp

index 4e63734155a302e6a4b7abc2e8de48de6e0eaf99..b3c1edd7a4aa6476d1786ccd0c56aa9b4405199a 100644 (file)
@@ -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());