]> git.lyx.org Git - features.git/commitdiff
tex2lyx/table.cpp: fix bug #8204 also for branch (prevent crash if TeX files define...
authorUwe Stöhr <uwestoehr@lyx.org>
Fri, 22 Jun 2012 23:13:43 +0000 (01:13 +0200)
committerUwe Stöhr <uwestoehr@lyx.org>
Fri, 22 Jun 2012 23:13:43 +0000 (01:13 +0200)
src/tex2lyx/table.cpp
status.20x

index 588d10c1b99421a78e995440e718ea9e4407a044..9884513a93ec55930392055d7cf3fd9f7f753def 100644 (file)
@@ -1156,8 +1156,20 @@ void handle_tabular(Parser & p, ostream & os, string const & name,
                                cellinfo[row][col].content += os.str();
 
                                // add dummy cells for multicol
-                               for (size_t i = 0; i < ncells - 1 && col < colinfo.size(); ++i) {
+                               for (size_t i = 0; i < ncells - 1; ++i) {
                                        ++col;
+                                       if (col >= colinfo.size()) {
+                                               cerr << "The cell '"
+                                                       << cells[cell]
+                                                       << "' specifies "
+                                                       << convert<string>(ncells)
+                                                       << " columns while the table has only "
+                                                       << convert<string>(colinfo.size())
+                                                       << " columns!"
+                                                       << " Therefore the surplus columns will be ignored."
+                                                       << endl;
+                                               break;
+                                       }
                                        cellinfo[row][col].multi = CELL_PART_OF_MULTICOLUMN;
                                        cellinfo[row][col].align = 'c';
                                }
index 2d024faecd952bf75d5d2f9be3e54b055587c65d..945c2b64527f02c4fdf0c64bcfb9215fe5af50b4 100644 (file)
@@ -276,6 +276,8 @@ What's new
 
 - Fix missing backslash in import of \def ... \csname ... \endcsname (bug 8116).
 
+- Fix crash if TeX-files contain table logic bugs (bug 8204).
+
 
 * ADVANCED FIND AND REPLACE