]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.C
Fix crash when running lyx -dbg insets -e ...
[lyx.git] / src / tabular.C
index 86091c6e36a02486ec4f65ffa911810f50349877..2202e3367bf818c2ec9959cfb7b9440345ff9c4e 100644 (file)
@@ -1504,6 +1504,10 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
                        || token == "\\end_float"
                        || token == "\\end_deeper") {
                        lex.pushToken(token);
+                       // Here we need to insert the inset_ert_contents into the last
+                       // cell of the tabular.
+                       owner_->bufferOwner()->insertErtContents(par, pos, font);
+                       
                        break;
                }
                if (owner_->bufferOwner()->parseSingleLyXformat2Token(lex, par,
@@ -1530,7 +1534,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
        for (int i = 0; i < par->size(); ++i) {
                if (par->isNewline(i)) {
                        ++cell;
-                       if (cell > GetNumberOfCells()) {
+                       if (cell > numberofcells) {
                                lyxerr << "Some error in reading old table format occured!" <<
                                        endl << "Terminating when reading cell[" << cell << "]!" <<
                                        endl;
@@ -1682,7 +1686,7 @@ bool LyXTabular::NeedRotating() const
 
 bool LyXTabular::IsLastCell(int cell) const
 {
-       if ((cell + 1) < GetNumberOfCells())
+       if ((cell + 1) < numberofcells)
                return false;
        return true;
 }
@@ -1726,6 +1730,7 @@ int LyXTabular::GetLastCellBelow(int cell) const
 
 int LyXTabular::GetCellNumber(int row, int column) const
 {
+#if 0
        if (column >= columns_)
                column = columns_ - 1;
        else if (column < 0)
@@ -1734,7 +1739,9 @@ int LyXTabular::GetCellNumber(int row, int column) const
                row = rows_ - 1;
        else if (row < 0)
                row = 0;
-       
+#else
+       lyx::Assert(column >= 0 || column < columns_ || row >= 0 || row < rows_);
+#endif
        return cell_info[row][column].cellno;
 }
 
@@ -2530,11 +2537,6 @@ InsetText * LyXTabular::GetCellInset(int cell) const
 
 InsetText * LyXTabular::GetCellInset(int row, int column) const
 {
-#ifdef WITH_WARNINGS
-#warning Juergen, should we check whether the row/column values are correct?
-// If we do not need to do that, the tests in GetCellNumber should be
-// changed to asserts.
-#endif
        cur_cell = GetCellNumber(row, column);
        return & cell_info[row][column].inset;
 }