Add assertion to debug NaN startRow on TextEditorPresenter

Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
Max Brunsfeld 2017-02-10 16:03:16 -08:00 committed by Nathan Sobo
parent c5715e5211
commit 162a85a0e1

View File

@ -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?