This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Uncaught TypeError: Cannot read property 'length' of undefined #402
Copy link
Copy link
Closed
Labels
Description
[Enter steps to reproduce below:]
- Double click on a word ('collect_highlights') in a Ruby file
- Press cmd-g
Expected result:
- A search for occurrences of 'collect_highlights'
Current result:
- An error dialog
Atom Version: 0.204.0
System: Mac OS X 10.10.3
Thrown From: find-and-replace package, v0.169.0
Stack Trace
Uncaught TypeError: Cannot read property 'length' of undefined
At /Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/find-and-replace/lib/find-view.js:449
TypeError: Cannot read property 'length' of undefined
at FindView.module.exports.FindView.findAndSelectResult (/Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/find-and-replace/lib/find-view.js:449:23)
at FindView.findAndSelectResult (/Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/find-and-replace/lib/find-view.js:3:61)
at FindView.module.exports.FindView.findNext (/Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/find-and-replace/lib/find-view.js:429:19)
at FindView.findNext (/Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/find-and-replace/lib/find-view.js:3:61)
at atom-workspace.subscriptions.add.atom.commands.add.find-and-replace:find-next (/Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/find-and-replace/lib/find-view.js:343:26)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/src/command-registry.js:238:29)
at /Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:520:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:355:22)
at HTMLDocument.module.exports.WindowEventHandler.onKeydown (/Users/johan/Downloads/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:178:20)
Commands
-8:31.1.0 core:move-right (atom-text-editor.editor.is-focused)
-8:30.5.0 core:move-up (atom-text-editor.editor.is-focused)
-0:32.5.0 command-palette:toggle (atom-text-editor.editor.is-focused)
5x -0:31 core:backspace (atom-text-editor.editor.mini.is-focused)
-0:23.7.0 core:confirm (atom-text-editor.editor.mini.is-focused)
-0:23.7.0 symbols-view:go-to-declaration (atom-text-editor.editor)
-0:21.7.0 find-and-replace:show (atom-text-editor.editor.is-focused)
2x -0:18.3.0 find-and-replace:find-next (atom-text-editor.editor.is-focused)
-0:07.0 editor:consolidate-selections (atom-text-editor.editor.is-focused)
-0:07.0 core:cancel (atom-text-editor.editor.is-focused)
-0:01.0 find-and-replace:find-next (atom-text-editor.editor.is-focused)
Config
{
"core": {
"themes": [
"unity-ui",
"atom-light-syntax"
]
}
}Installed Packages
# User
autocomplete-paths, v1.0.2
color-picker, v2.0.2
language-gitignore, v0.2.0
linter, v0.12.6
linter-rubocop, v0.2.7
linter-ruby, v0.1.6
minimap, v4.9.0
pigments, v0.3.1
test-status, v0.33.0
unity-ui, v2.0.10
# Dev
No dev packages
Activity
winstliu commentedon May 31, 2015
Hi @walles, could you please upload the file you were working with as a Gist and then paste the Gist link here? Thanks.
I just tried reproducing this using a minimal test case:
First, I double-clicked
collect_highlightsto highlight it. Then, I tried pressing F3 (which is the equivalent of Cmd+G on Windows/Linux), but nothing happened 😦. No error, but that still seems like unexpected behavior to me.walles commentedon May 31, 2015
Here's the file:
https://github.com/walles/riff/blob/b9fcd0991e6e4e57116be52ae4b6a2cd1b6e140c/lib/refiner.rb
Note though that I'm not convinced this is easily reproducible, so a better approach than trying to repro it is stack trace inspired code reading. What can make you try to access
lengthofundefinedatfind-and-replace/lib/find-view.js:449:23?shawnbmiller commentedon Jul 4, 2015
I think I have steps to reproduce this in a slightly different way. This was done on Windows 7, Atom version 1.0.0.
Exception details below:
Atom Version: 1.0.0
System: Microsoft Windows 7 Professional
Thrown From: find-and-replace package, v0.174.0
Stack Trace
Uncaught TypeError: Cannot read property 'length' of undefined
Commands
Config
{}Installed Packages
izuzak commentedon Jul 5, 2015
Thanks for the reproduction steps, @shawnbmiller. ⚡ Using an empty "find" pattern when replacing triggers one such exception (though I'm not sure it's the same problem which was originally reported -- seems to have a different stack trace). /cc @benogle
izuzak commentedon Jul 5, 2015
Ah, I think that the original problem was fixed by @nathansobo in ed00ffb. We should be able to fix the other report with the same approach -- here's a PR to get us there: #434.