]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.cpp
Fix a crash with uninitialized buffer member of MathData
[lyx.git] / src / mathed / InsetMathNest.cpp
index bc3c2add0eadbf963aa66a0b140c4156d7f10d16..db03dabcafa3f65423c736b089c63b7511eef856 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]);