reergymerej / todo

an Atom package for finding TODO statements
https://atom.io/packages/todo
MIT License
10 stars 3 forks source link

Uncaught TypeError: Cannot read property '0' of undefined #12

Closed ssrballin closed 8 years ago

ssrballin commented 8 years ago

Enter steps to reproduce below:

  1. Created a todo comment in a python file TODO: fix me
  2. Toggled todo and hit todo refresh
  3. Clicked on the todo within the todo pane
  4. Threw error

Atom Version: 1.8.0 System: Mac OS X 10.11.5 Thrown From: todo package, v0.2.1

Stack Trace

Uncaught TypeError: Cannot read property '0' of undefined

At /Users/saadsiddiqui/.atom/packages/todo/lib/todo-view.coffee:63

TypeError: Cannot read property '0' of undefined
    at TodoView.module.exports.TodoView.onItemClick (/Users/saadsiddiqui/.atom/packages/todo/lib/todo-view.coffee:63:34)
    at HTMLElement.<anonymous> (/Users/saadsiddiqui/.atom/packages/todo/lib/todo-view.coffee:57:10)

Commands

     -5:34.8.0 application:add-project-folder (ul.list-inline.tab-bar.inset-panel)
 32x -5:01.6.0 core:move-down (atom-text-editor.editor.power-mode.is-focused)
 15x -4:58.3.0 core:move-right (atom-text-editor.editor.power-mode.is-focused)
 11x -4:56.6.0 core:move-left (atom-text-editor.editor.power-mode.is-focused)
 14x -4:55.2.0 core:move-right (atom-text-editor.editor.power-mode.is-focused)
 13x -4:53.6.0 core:move-left (atom-text-editor.editor.power-mode.is-focused)
  7x -4:52.1.0 core:move-right (atom-text-editor.editor.power-mode.is-focused)
     -1:11 settings-view:open (atom-text-editor.editor.power-mode.is-focused)
     -1:03.9.0 core:confirm (atom-text-editor.editor.mini.is-focused)
  3x -0:44.4.0 editor:newline (atom-text-editor.editor.power-mode.is-focused)
     -0:42.2.0 core:move-up (atom-text-editor.editor.power-mode.is-focused)
  3x -0:35.9.0 core:move-down (atom-text-editor.editor.power-mode.is-focused)
     -0:25.4.0 todo:toggle (atom-text-editor.editor.power-mode.is-focused)

Config

{}

Installed Packages

# User
activate-power-mode, v0.5.2
todo, v0.2.1

# Dev
No dev packages
reergymerej commented 8 years ago

Thanks for reporting the issue. I'll see what I can find out.

reergymerej commented 8 years ago

This was happening because the range was not present for some reason when the selection was made. I was not able to reproduce the issue, but I put in a bandaid (744d3d5b543c9fd8c4ccce4f41ac039003dc367e) to keep it from throwing. My guess is that after clicking refresh, the previous results were invalidated, and one of them was clicked (before the new results appeared). I'll see if I can reproduce this. Either way, old results should probably be cleared when refresh is clicked.

reergymerej commented 8 years ago

This has been rebuilt with a different view layer and the next version will remove old results while refreshing. We also double-check to ensure a range is present on click, so probably safe to close this.