prevent tex2lyx segfault

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9318 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2004-11-27 13:42:14 +00:00
parent 08762a396f
commit fd3bed6b15
2 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2004-11-27 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* 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 <Georg.Baum@post.rwth-aachen.de>
* tex2lyx.C: remove format hack

View File

@ -100,6 +100,16 @@ void handle_colalign(Parser & p, vector<ColInfo> & 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) {