]> git.lyx.org Git - features.git/commitdiff
Fix a crash with uninitialized buffer member of MathData
authorStephan Witt <switt@lyx.org>
Fri, 7 Feb 2020 09:17:33 +0000 (10:17 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:51 +0000 (15:48 +0200)
See the details here: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg210294.html

src/mathed/InsetMathNest.cpp

index 62c04f439e458c8074c8dcb7d93b01ba351e0dfb..4f6d150d32d50fa6d3f26db02e7759c820eaef1e 100644 (file)
@@ -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]);