From: Stephan Witt Date: Fri, 7 Feb 2020 09:17:33 +0000 (+0100) Subject: Fix a crash with uninitialized buffer member of MathData X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=889c2d2f615efc3802b22d983d317a18a297ba3f;p=features.git Fix a crash with uninitialized buffer member of MathData See the details here: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg210294.html --- diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 62c04f439e..4f6d150d32 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -1232,10 +1232,12 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd) cur.recordUndoSelection(); if (cmd.argument() == "^" || cmd.argument() == "_") interpretChar(cur, cmd.argument()[0]); + else if (!cur.selection()) + cur.niceInsert(cmd.argument()); else { - MathData ar; + MathData ar(cur.buffer()); asArray(cmd.argument(), ar); - if (cur.selection() && ar.size() == 1 + if (ar.size() == 1 && ar[0]->asNestInset() && ar[0]->asNestInset()->nargs() > 1) handleNest(cur, ar[0]);