]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathNest.cpp
Fix LFUN_MATH_AMS_MATRIX: it was possible to generate corrupt documents (part of...
[features.git] / src / mathed / InsetMathNest.cpp
index b9a2ed4098be91bf59c34b537ad41fc19fe64927..3d31b9ac79930aa5e3d3e220bf73a536113352a1 100644 (file)
@@ -1079,13 +1079,19 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
                cur.recordUndo();
                unsigned int m = 1;
                unsigned int n = 1;
-               docstring name;
+               docstring name = from_ascii("matrix");
                idocstringstream is(cmd.argument());
                is >> m >> n >> name;
                if (m < 1)
                        m = 1;
                if (n < 1)
                        n = 1;
+               // check if we have a valid decoration
+               if (name != "pmatrix" && name != "bmatrix"
+                       && name != "Bmatrix" && name != "vmatrix"
+                       && name != "Vmatrix" && name != "matrix")
+                       name = from_ascii("matrix");
+               
                cur.niceInsert(
                        MathAtom(new InsetMathAMSArray(buffer_, name, m, n)));
                break;