Lars, may I submit this patch to reLyX please. It simply adds a paranoia 
check that we don't attempt to access an element beyond the end of the 
array. 

It therefore removes a warning message generated because reLyX tries to 
access a non-existent column when reading the test case to bug 722.

In this particular case, the problem is caused because reLyX doesn't 
recognize the column descriptor 'm{1.5in}' and so reads

\begin{tabular}{m{1.5in}rrr}
A&B&C&D\tabularnewline
...

as
\begin{tabular}{rrr}
A&B&C&D\tabularnewline
...

with obvious consequences.
Angus


Index: lib/reLyX/RelyxTable.pm
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/reLyX/RelyxTable.pm,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 RelyxTable.pm
--- lib/reLyX/RelyxTable.pm     27 Sep 1999 18:44:34 -0000      1.1.1.1
+++ lib/reLyX/RelyxTable.pm     2 Feb 2003 23:45:19 -0000
@@ -457,7 +457,13 @@ package RelyxTable::Row;
        $i++;

        # What if it was a multicolumn?
-       $i++ while ${$row->{"cells"}}[$i]->{"multicolumn"} eq "part";
+       # $rcells holds a reference to the array of cells
+       my $rcells = \@{$row->{"cells"}};
+       # Paranoia check that we're not attempting to access beyond the
+       # end of the array in case reLyX failed to parse the number of
+       # columns correctly.
+       $i++ while ($i < @{$rcells} &&
+                   ${$rcells}[$i]->{"multicolumn"} eq "part");

        $row->{"curr_col"} = $i;
     } # end of sub nextcol


Reply via email to