]> git.lyx.org Git - features.git/commitdiff
handle missing parameters more gracefully
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 25 Jul 2001 22:05:53 +0000 (22:05 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 25 Jul 2001 22:05:53 +0000 (22:05 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2349 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetcollapsable.C
src/insets/insetminipage.C

index 7101c8b40a31c44e9c7b27cace0099a5d94a76f1..3a044554a0c34058efb0ddceee1fcbc04cb93a99 100644 (file)
@@ -1,3 +1,9 @@
+2001-07-26  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insetminipage.C (read): handle missing parameters more gracefully
+
+       * insetcollapsable.C (read): handel missing collapsed more gracefully
+
 2001-07-25  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * insetfloat.C (read): handle missing parameters.
index b48f7a185e806fcfac7965645789c5e032a58808..2b9bdcd9d0651fe798155a033c9640f515ac5e2d 100644 (file)
@@ -116,6 +116,8 @@ void InsetCollapsable::read(Buffer const * buf, LyXLex & lex)
                } else {
                        lyxerr << "InsetCollapsable::Read: Missing collapsed!"
                               << endl;
+                       // Take countermeasures
+                       lex.pushToken(token);
                }
        }
        inset.read(buf, lex);
index 99db750f1d4369a3b0875a0d076def216f9d5955..b8afb1cd24e7dfe17abaa49b8af03904ded1af15 100644 (file)
@@ -110,64 +110,72 @@ void InsetMinipage::write(Buffer const * buf, ostream & os) const
 
 void InsetMinipage::read(Buffer const * buf, LyXLex & lex)
 {
-       string token;
+       //string token;
 
        if (lex.IsOK()) {
                lex.next();
-               token = lex.GetString();
+               string const token = lex.GetString();
                if (token == "position") {
                        lex.next();
                        pos_ = static_cast<Position>(lex.GetInteger());
-                       token = string();
+                       //token = string();
                } else {
                        lyxerr << "InsetMinipage::Read: Missing 'position'-tag!"
                                   << endl;
+                       // take countermeasures
+                       lex.pushToken(token);
                }
        }
        if (lex.IsOK()) {
-               if (token.empty()) {
-                       lex.next();
-                       token = lex.GetString();
-               }
+               //if (token.empty()) {
+               lex.next();
+               string const token = lex.GetString();
+               //}
                if (token == "inner_position") {
                        lex.next();
                        inner_pos_ = static_cast<InnerPosition>(lex.GetInteger());
-                       token = string();
+                       //token = string();
                } else {
                        lyxerr << "InsetMinipage::Read: Missing 'inner_position'-tag!"
                                   << endl;
+                       // take countermeasures
+                       lex.pushToken(token);
                }
        }
        if (lex.IsOK()) {
-               if (token.empty()) {
-                       lex.next();
-                       token = lex.GetString();
-               }
+               //if (token.empty()) {
+               lex.next();
+               string const token = lex.GetString();
+               //}
                if (token == "height") {
                        lex.next();
                        height_ = lex.GetString();
-                       token = string();
+                       //token = string();
                } else {
                        lyxerr << "InsetMinipage::Read: Missing 'height'-tag!"
                                   << endl;
+                       // take countermeasures
+                       lex.pushToken(token);
                }
        }
        if (lex.IsOK()) {
-               if (token.empty()) {
-                       lex.next();
-                       token = lex.GetString();
-               }
+               //if (token.empty()) {
+               lex.next();
+               string const token = lex.GetString();
+               //}
                if (token == "width") {
                        lex.next();
                        width_ = lex.GetString();
-                       token = string();
+                       //token = string();
                } else {
                        lyxerr << "InsetMinipage::Read: Missing 'width'-tag!"
                                   << endl;
+                       // take countermeasures
+                       lex.pushToken(token);
                }
        }
-       if (!token.empty())
-               lex.pushToken(token);
+       //if (!token.empty())
+       //      lex.pushToken(token);
        InsetCollapsable::read(buf, lex);
 }