From: Georg Baum Date: Sat, 27 Nov 2004 13:42:14 +0000 (+0000) Subject: prevent tex2lyx segfault X-Git-Tag: 1.6.10~14783 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=fd3bed6b15ccff0479127687783170008125dcf2;p=features.git prevent tex2lyx segfault git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9318 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/tex2lyx/ChangeLog b/src/tex2lyx/ChangeLog index a064eed91d..0c8c2b3f60 100644 --- a/src/tex2lyx/ChangeLog +++ b/src/tex2lyx/ChangeLog @@ -1,3 +1,9 @@ +2004-11-27 Georg Baum + + * table.C (handle_colalign): handle comments + * table.C (handle_tabular): don't crash on clines with out of range + columns + 2004-11-09 Georg Baum * tex2lyx.C: remove format hack diff --git a/src/tex2lyx/table.C b/src/tex2lyx/table.C index 2e51d50fb8..6f607f257b 100644 --- a/src/tex2lyx/table.C +++ b/src/tex2lyx/table.C @@ -100,6 +100,16 @@ void handle_colalign(Parser & p, vector & colinfo) cerr << "t: " << t << " c: '" << t.character() << "'\n"; #endif + // We cannot handle comments here + if (t.cat() == catComment) { + if (t.cs().empty()) { + // "%\n" combination + p.skip_spaces(); + } else + cerr << "Ignoring comment: " << t.asInput(); + continue; + } + switch (t.character()) { case 'c': case 'l': @@ -379,7 +389,19 @@ void handle_tabular(Parser & p, ostream & os, split(arg, t, '-'); t.resize(2); size_t from = string2int(t[0]) - 1; + if (from >= colinfo.size()) { + cerr << "cline starts at non " + "existing column " + << from << endl; + from = colinfo.size() - 1; + } size_t to = string2int(t[1]); + if (to >= colinfo.size()) { + cerr << "cline ends at non " + "existing column " + << to << endl; + to = colinfo.size() - 1; + } for (size_t col = from; col < to; ++col) { //cerr << "row: " << row << " col: " << col << " i: " << i << endl; if (i == 0) {