Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Uncaught TypeError: Cannot read property 'length' of undefined #18837

Closed

Description

@Arcanemagus

Prerequisites

Description

Sometimes when restoring a session (rendering content?) an uncaught error is thrown.

Steps to Reproduce

  1. Unknown, saw while restoring a session on restarting Atom.

Expected behavior: [What you expect to happen]
No crash

Actual behavior: [What actually happens]

Stack Trace

Uncaught TypeError: Cannot read property 'length' of undefined

At C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:14

TypeError: Cannot read property 'length' of undefined
    at DisplayLayer.updateSpatialIndex (~/AppData/Local/atom/app-1.37.0-nightly0/resources/app/static/<embedded>:14:93829)
    at DisplayLayer.populateSpatialIndexIfNeeded (~/AppData/Local/atom/app-1.37.0-nightly0/resources/app/static/<embedded>:14:94974)
    at DisplayLayer.doBackgroundWork (~/AppData/Local/atom/app-1.37.0-nightly0/resources/app/static/<embedded>:14:81248)
    at TextEditor.doBackgroundWork (~/AppData/Local/atom/app-1.37.0-nightly0/resources/app/static/<embedded>:11:641)

Reproduces how often: [What percentage of the time does it reproduce?]
Unknown, however it looks like this has been happening since at least v1.32.2.

Versions

OS: Microsoft Windows 10 Pro x64

Atom    : 1.37.0-nightly0
Electron: 3.1.3
Chrome  : 66.0.3359.181
Node    : 10.2.0
apm  2.1.3
npm  6.2.0
node 8.9.3 x64
atom 1.37.0-nightly0
python 2.7.15
git 2.20.1.windows.1
visual studio 2015
Non-Core Packages
atom-beautify 0.33.4
atom-ide-debugger-node 0.7.3
atom-ide-debugger-python 0.7.3
atom-ide-ui 0.13.0
atom-linter-phpstan 1.0.2
atom-material-ui 2.1.3
autoclose-html 0.23.0
autocomplete-lua 0.9.1
busy-signal 2.0.0
docblockr 0.13.7
editorconfig 2.2.2
file-watcher 2.0.0
highlight-selected 0.14.0
ide-bash 1.0.11
ide-flowtype 0.24.0
ide-php 0.7.18
ide-powershell 0.1.0
ide-python 1.2.0
ide-typescript 0.8.0
intentions 1.1.5
language-ansible 0.2.2
language-batch 0.4.0
language-chef 3.5.1
language-cjson 0.0.1
language-docker 1.1.8
language-elixir 0.22.1
language-erlang 3.2.0
language-fortran 2.1.7
language-gettext 0.6.1
language-glsl 2.0.4
language-haml 0.32.1
language-haskell 1.18.0
language-icinga2 0.4.1
language-ini 1.20.0
language-jolie 0.5.0
language-kotlin 0.5.0
language-livescript 0.0.3
language-lua 0.9.11
language-moonscript 1.7.1
language-postcss 1.3.1
language-powershell 5.0.0
language-pug 0.0.22
language-puppet 0.23.0
language-reg 0.0.0
language-rust 0.4.12
language-swift 0.5.0
language-terraform 0.8.1
language-vue 0.24.0
linter 2.3.0
linter-coffeelint 2.0.1
linter-eslint 8.5.2
linter-flake8 2.4.0
linter-htmlhint 1.6.0
linter-js-standard 6.1.0
linter-js-yaml 1.4.2
linter-jsonlint 1.4.0
linter-markdown 5.2.2
linter-perl 0.9.0
linter-perlcritic 2.2.2
linter-php 1.6.0
linter-phpcs 1.6.12
linter-phpmd 2.0.1
linter-proselint 3.3.0
linter-pylama 0.10.1
linter-pylint 2.1.1
linter-rails-best-practices 0.2.2
linter-reek 2.4.1
linter-rubocop 2.2.3
linter-ruby 1.3.0
linter-stylelint 4.4.3
linter-tidy 2.4.0
linter-ui-default 1.7.1
linter-ui-plus 0.3.2
mapfile-grammar 0.1.0
minimap 4.29.9
minimap-git-diff 4.3.1
minimap-highlight-selected 4.6.1
minimap-linter 2.2.1
minimap-selection 4.5.0
sequential-number 0.5.0
sort-lines 0.18.0
sync-settings 0.8.6
tab-control 0.6.11
teletype 0.13.3
terminal-tab 0.5.7
terminal-tab-service 0.1.4
toggle-quotes 1.1.3
town-crier 0.3.0
trailing-spaces 0.4.0

Additional Information

Also reported here:

However as the title is common to other issues this wasn't seen as a separate problem.

Activity

  1. Arcanemagus commented on Feb 13, 2019

    @Arcanemagus
    ContributorAuthor

    Related stack trace:

    TypeError: Cannot read property 'length' of undefined
        at DisplayLayer.updateSpatialIndex (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:14:93829)
        at DisplayLayer.populateSpatialIndexIfNeeded (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:14:94974)
        at TextEditorComponent.populateVisibleRowRange (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:117228)
        at TextEditorComponent.updateModelSoftWrapColumn (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:101856)
        at TextEditorComponent.updateSyncBeforeMeasuringContent (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:69632)
        at TextEditorComponent.updateSync (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:67605)
        at TextEditorComponent.didShow (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:91294)
        at TextEditorComponent.didAttach (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:90464)
        at HTMLElement.attachedCallback (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app.asar\src\text-editor-element.js:41:25)
        at HTMLElement.activeItemChanged (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app.asar\src\pane-element.js:152:22)
        at Function.simpleDispatch (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:1172043)
        at Emitter.emit (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:1173484)
        at Pane.setActiveItem (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:456205)
        at Pane.activateItemAtIndex (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:458256)
        at Pane.activateNextItem (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:457634)
        at Pane.removeItem (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:460451)
        at Pane.destroyItem (C:\Users\Lando\AppData\Local\atom\app-1.37.0-nightly0\resources\app\static\<embedded>:11:461760)
    
  2. Arcanemagus commented on Feb 13, 2019

    @Arcanemagus
    ContributorAuthor

    I suspect that this is due to this.screenLineLengths being uninitialized here, but I can't see how that could happen.

  3. Aerijo commented on Feb 13, 2019

    @Aerijo
    Contributor

    @Arcanemagus Easily, if params.spatialIndex is not falsey (including not 0; is this a potential problem?) and params.screenLineLengths is undefined.

    That also appears to be the only assignment to that property in the TextEditor, and seems like an odd thing for external parts to change.

  4. Arcanemagus commented on Feb 13, 2019

    @Arcanemagus
    ContributorAuthor

    Well yes, that's the obvious way, but I couldn't find any instance of that outside atom/text-buffer.

    That's the only variable that has .length accessed and isn't defined within that function though.

  5. Aerijo commented on Feb 13, 2019

    @Aerijo
    Contributor

    At times like this I wish we were using TypeScript. I've never know quite where those params came from.

  6. added
    electron-3
    and removed
    electron-3
    on May 14, 2019
  7. rafeca commented on May 15, 2019

    @rafeca
    Contributor

    Since this issue was already happening in v1.32.2 an v1.34, it does not look like an electron v3 issue, so I've removed the label.

  8. stale commented on May 15, 2020

    @stale

    Thanks for your contribution!

    This issue has been automatically marked as stale because it has not had recent activity. Because the Atom team treats their issues as their backlog, stale issues are closed. If you would like this issue to remain open:

    1. Verify that you can still reproduce the issue in the latest version of Atom
    2. Comment that the issue is still reproducible and include:
      • What version of Atom you reproduced the issue on
      • What OS and version you reproduced the issue on
      • What steps you followed to reproduce the issue

    Issues that are labeled as triaged will not be automatically marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions