]> git.lyx.org Git - features.git/commitdiff
* at least return a valid template on parse error, but:
authorStefan Schimanski <sts@lyx.org>
Wed, 19 Dec 2007 22:57:22 +0000 (22:57 +0000)
committerStefan Schimanski <sts@lyx.org>
Wed, 19 Dec 2007 22:57:22 +0000 (22:57 +0000)
FIXME: The macro template does not make sense after this.
  The whole parsing should not be in a constructor which
  has no chance to report failure.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22214 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/MathMacroTemplate.cpp

index 704c05f55c99ffb44e493ce981b98516e969134a..f3c2eb106c84b4b40b57ac1e262db9cb52cc489c 100644 (file)
@@ -119,7 +119,8 @@ MathMacroTemplate::MathMacroTemplate(docstring const & name, int numargs,
 
 
 MathMacroTemplate::MathMacroTemplate(docstring const & str)
-       : InsetMathNest(3), numargs_(0)
+       : InsetMathNest(3), numargs_(0), optionals_(0), 
+               type_(MacroTypeNewcommand)
 {
        initMath();
 
@@ -127,6 +128,10 @@ MathMacroTemplate::MathMacroTemplate(docstring const & str)
        mathed_parse_cell(ar, str);
        if (ar.size() != 1 || !ar[0]->asMacroTemplate()) {
                lyxerr << "Cannot read macro from '" << ar << "'" << endl;
+               asArray(from_ascii("invalidmacro"), cell(0));
+               // FIXME: The macro template does not make sense after this.
+               // The whole parsing should not be in a constructor which
+               // has no chance to report failure.
                return;
        }
        operator=( *(ar[0]->asMacroTemplate()) );