DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/326162 )

Change subject: ui.TableAction: don't try to add cells if none have been 
provided
......................................................................

ui.TableAction: don't try to add cells if none have been provided

Former code expected that if an empty cell was reached, the dataMatrixLine
*must* have been provided with cells that would fill it. This didn't account
for the possibility of sparse rows (e.g. <tr></tr>).

Alter it to just skip absent cells if no data was provided to fill them.

Bug: T152387
Bug: T152659
Change-Id: Ia30be000a649285f744facf38d28faaaf60ae881
---
M src/ui/actions/ve.ui.TableAction.js
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/62/326162/1

diff --git a/src/ui/actions/ve.ui.TableAction.js 
b/src/ui/actions/ve.ui.TableAction.js
index 3f4e568..7682283 100644
--- a/src/ui/actions/ve.ui.TableAction.js
+++ b/src/ui/actions/ve.ui.TableAction.js
@@ -584,7 +584,11 @@
        for ( i = 0, l = Math.max( cells.length, dataMatrixLine ? 
dataMatrixLine.cells.length : 0 ); i < l; i++ ) {
                cell = cells[ i ];
                if ( !cell ) {
-                       insertCells.push( dataMatrixLine.cells[ i ] );
+                       if ( dataMatrixLine && dataMatrixLine.cells[ i ] ) {
+                               // if we've been given data to fill the empty 
cells with, do so
+                               insertCells.push( dataMatrixLine.cells[ i ] );
+                       }
+                       // either way, continue on to the next cell
                        continue;
                }
                refCell = refCells[ i ];

-- 
To view, visit https://gerrit.wikimedia.org/r/326162
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia30be000a649285f744facf38d28faaaf60ae881
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <dly...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to