From 162a85a0e108e575cf118ff25283cb8ebaca573f Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 10 Feb 2017 16:03:16 -0800 Subject: [PATCH] Add assertion to debug NaN startRow on TextEditorPresenter Signed-off-by: Nathan Sobo --- src/text-editor-presenter.coffee | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/text-editor-presenter.coffee b/src/text-editor-presenter.coffee index 3c4739ca5..1106cee09 100644 --- a/src/text-editor-presenter.coffee +++ b/src/text-editor-presenter.coffee @@ -622,6 +622,18 @@ class TextEditorPresenter return unless @scrollTop? and @lineHeight? @startRow = Math.max(0, @lineTopIndex.rowForPixelPosition(@scrollTop)) + atom.assert( + Number.isFinite(@startRow), + 'Invalid start row', + (error) => + error.metadata = { + startRow: @startRow?.toString(), + scrollTop: @scrollTop?.toString(), + scrollHeight: @scrollHeight?.toString(), + clientHeight: @clientHeight?.toString(), + lineHeight: @lineHeight?.toString() + } + ) updateEndRow: -> return unless @scrollTop? and @lineHeight? and @height?