DLynch has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/307533

Change subject: getNodeAndOffset: check whether the node has a view before 
using it
......................................................................

getNodeAndOffset: check whether the node has a view before using it

Bug: T139972
Change-Id: Icd975768a09cd979306353d0f25eb64ada6e1ced
---
M src/ce/ve.ce.Document.js
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/33/307533/1

diff --git a/src/ce/ve.ce.Document.js b/src/ce/ve.ce.Document.js
index eb6c994..021201f 100644
--- a/src/ce/ve.ce.Document.js
+++ b/src/ce/ve.ce.Document.js
@@ -186,7 +186,7 @@
        // Find all subsequent DOM positions at the same model offset
        found = {};
        function stop( step ) {
-               var model;
+               var view, model;
                if ( step.node.nodeType === Node.TEXT_NODE ) {
                        return step.type === 'internal';
                }
@@ -195,6 +195,10 @@
                        step.node.classList.contains( 've-ce-branchNode' ) ||
                        step.node.classList.contains( 've-ce-leafNode' )
                ) {
+                       view = $.data( step.node, 'view' );
+                       if ( !view ) {
+                               return false;
+                       }
                        model = $.data( step.node, 'view' ).model;
                        if ( countedNodes.indexOf( model ) !== -1 ) {
                                return false;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd975768a09cd979306353d0f25eb64ada6e1ced
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to