mehcode / atom-project-plus

Simply awesome project management in Atom.
https://atom.io/packages/project-plus
MIT License
99 stars 19 forks source link

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

Closed vasa-chi closed 8 years ago

vasa-chi commented 8 years ago

[Enter steps to reproduce below:]

  1. Open Atom
  2. Click Ctrl-Cmd-P

Atom Version: 1.5.3 System: Mac OS X 10.11.3 Thrown From: project-plus package, v0.4.2

Stack Trace

Uncaught TypeError: Cannot read property '0' of undefined

At /Users/vasa/.atom/packages/project-plus/lib/util.coffee:41

TypeError: Cannot read property '0' of undefined
    at /Users/vasa/.atom/packages/project-plus/lib/util.coffee:41:45
    at Array.map (native)
    at sanitize (/Users/vasa/.atom/packages/project-plus/lib/util.coffee:38:17)
    at /Users/vasa/.atom/packages/project-plus/lib/util.coffee:96:19
    at /Users/vasa/.atom/packages/project-plus/node_modules/async/lib/async.js:52:16
    at /Users/vasa/.atom/packages/project-plus/node_modules/async/lib/async.js:361:13
    at /Users/vasa/.atom/packages/project-plus/node_modules/async/lib/async.js:52:16
    at done (/Users/vasa/.atom/packages/project-plus/node_modules/async/lib/async.js:246:17)
    at /Users/vasa/.atom/packages/project-plus/node_modules/async/lib/async.js:44:16
    at /Users/vasa/.atom/packages/project-plus/node_modules/async/lib/async.js:358:17
    at /Users/vasa/.atom/packages/project-plus/lib/util.coffee:93:13
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

Commands

     -0:29 project-plus:toggle-project-finder (atom-pane.pane.active)
     -0:11.9.0 command-palette:toggle (atom-pane.pane.active)
  3x -0:07.6.0 editor:delete-to-beginning-of-word (atom-text-editor.editor.mini.is-focused)
     -0:06.1.0 core:backspace (atom-text-editor.editor.mini.is-focused)
  3x -0:04.3.0 core:move-down (atom-text-editor.editor.mini.is-focused)
     -0:02.2.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -0:02.2.0 project-plus:toggle-project-finder (atom-pane.pane.active)

Config

{
  "core": {
    "customFileTypes": {
      "source.js.jsx": [
        "js",
        "jsx",
        "es6"
      ]
    },
    "disabledPackages": [
      "atom-ctags",
      "linter-scss-lint",
      "autosave",
      "autocomplete",
      "linter-python-pyflakes"
    ],
    "packagesWithKeymapsDisabled": [
      "color-picker",
      "highlight-line"
    ],
    "themes": [
      "atom-material-ui",
      "atom-material-syntax"
    ]
  }
}

Installed Packages

# User
angularjs, v0.3.4
atom-django, v0.3.2
atom-material-syntax, v0.4.3
atom-material-ui, v1.2.0
autoclose-html, v0.22.0
autocomplete-modules, v1.4.1
autocomplete-paths, v1.0.2
autocomplete-python, v1.6.1
block-travel, v1.0.4
color-picker, v2.1.1
compare-files, v0.6.2
django-templates, v0.5.0
editorconfig, v1.2.4
emmet, v2.4.1
file-icons, v1.6.16
git-diff-details, v0.23.0
git-log, v0.4.1
highlight-line, v0.11.1
highlight-selected, v0.11.2
language-babel, v2.15.4
language-elixir, v0.11.1
language-elm, v1.3.2
linter, v1.11.3
linter-eslint, v7.0.0
linter-flake8, v1.12.0
linter-jsonlint, v1.1.6
linter-less, v2.4.2
minimap, v4.19.0
minimap-find-and-replace, v4.4.0
minimap-git-diff, v4.1.8
minimap-pigments, v0.1.7
pigments, v0.24.1
project-plus, v0.4.2
python-isort, v0.0.7

# Dev
No dev packages
mehcode commented 8 years ago

Thanks for the report. You've apparently got an editor state serialized that has a valid project object but atom.project.paths is null. Strange. I assumed it'd be [] in this case but eh.. more things you find out.

If someone wants to fix this we just need to check for row.project.paths? where we check for row.project?. I should get to it later tonight. See: https://github.com/mehcode/atom-project-plus/blob/master/lib/util.coffee#L34

mikekolganov commented 8 years ago

@mehcode Thanks for troubleshooting instruction!

mehcode commented 8 years ago

@mikekolganov Thanks for stepping up to fix this.