Page MenuHomePhabricator

Cannot read property 'getOffset' of null
Closed, ResolvedPublic

Description

Found when trying to reproduce T199011.

Refactoring done here changed the parameters that ve.ce.Document.prototype.getNodeAndOffset takes, but usage in ve.ce.Surface.prototype.getSelectionState was not updated.

In ve.ce.Document.prototype.getNodeAndOffset is the following code branchNode = this.getBranchNodeFromOffset( offset ).
ve.Document.prototype.getBranchNodeFromOffset can return null, but the next line just uses branchNode with count = branchNode.getOffset() + ( ( branchNode.isWrapped() ) ? 1 : 0 ) and we got the error from the title of this ticket.

Same error on T196521.

Details

Event Timeline

Pginer-WMF added a subscriber: Pginer-WMF.

Same error on T196521.

I think it is unfortunately not related, I just debugged that problem and it is specific to the find-and-replace dialog.

Change 449392 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[VisualEditor/VisualEditor@master] ve.ce.Surface: Handle null native selections in #getSelectionState and #showSelectionState

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

Change 449393 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[VisualEditor/VisualEditor@master] Remove unused second parameters to ve.ce.Document#getNodeAndOffset

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

Change 449392 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] ve.ce.Surface: Handle null native selections in #getSelectionState and #showSelectionState

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

Change 450658 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (deaf0394e)

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

Change 449393 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Remove unused second parameters to ve.ce.Document#getNodeAndOffset

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

Change 450658 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (efccd8b41)

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

Followed the steps mentioned in T199011 to verify this, not getting this error anymore.

Deskana closed this task as Resolved.Aug 8 2018, 1:58 PM
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptAug 8 2018, 1:58 PM