klorenz / atom-table-editor

Easily edit and navigate markdown tables
MIT License
13 stars 3 forks source link

Uncaught TypeError: Cannot read property 'replace' of undefined #5

Open jimklo opened 8 years ago

jimklo commented 8 years ago

[Enter steps to reproduce below:]

  1. Installed plugin
  2. Restarted Atom
  3. Opened existing RST file with table that needed formatting cleanup
  4. Pressed TAB key.
  5. Exception thrown

Here's the RST table that throws the error:


+------------------------+----------------------------------------------------------------------------+
| Sub Project            | Artifact Path                                                              |
+========================+============================================================================+
| Sunflower Studio Tasks | ``src-root/sunflower-studio/sunflower-sri/com.sri.sunflower.distrib.tasks/target/products`` |
+------------------------+----------------------------------------------------------------------------+
| Sunflower Studio CE    | ``src-root/sunflower-studio/sunflower-open/com.sri.sunflower.distrib.core/target/products`` |
+------------------------+----------------------------------------------------------------------------+
| Floralib               | ``src-root/sunflower-foundation/floralib/target``                                      |
+------------------------+----------------------------------------------------------------------------+
| Floralib External      | ``src-root/sunflower-foundation/floralib-ext/target``                                  |
+------------------------+----------------------------------------------------------------------------+

Atom Version: 1.7.4 System: Mac OS X 10.10.5 Thrown From: table-editor package, v0.2.0

Stack Trace

Uncaught TypeError: Cannot read property 'replace' of undefined

At /Users/jklo/.atom/packages/table-editor/lib/table-formatter.coffee:65

TypeError: Cannot read property 'replace' of undefined
    at TableFormatter.module.exports.TableFormatter.linesEqual (/Users/jklo/.atom/packages/table-editor/lib/table-formatter.coffee:65:10)
    at TableFormatter.module.exports.TableFormatter.getSelectionRanges (/Users/jklo/.atom/packages/table-editor/lib/table-formatter.coffee:160:18)
    at Object.module.exports.TableEditor.formatTable (/Users/jklo/.atom/packages/table-editor/lib/table-editor.coffee:181:7)
    at atom-text-editor.subscriptions.add.atom.commands.add.table-editor:next-cell (/Users/jklo/.atom/packages/table-editor/lib/table-editor.coffee:33:37)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)

Commands

     -0:00.9.0 table-editor:next-cell (atom-text-editor.editor.is-focused.table-editor-active)

Config

{
  "core": {}
}

Installed Packages

# User
angularjs, v0.3.4
angularjs-styleguide-snippets-es6, v1.0.3
atom-html-preview, v0.1.19
autocomplete-python, v1.7.3
color-picker, v2.1.1
dockerletion, v0.2.0
editorconfig, v1.4.1
emmet, v2.4.3
file-icons, v1.7.13
fill-line, v1.0.0
highlight-selected, v0.11.2
language-docker, v1.1.6
language-restructuredtext, v0.15.0
line-ending-converter, v1.3.2
linter, v1.11.4
merge-conflicts, v1.4.3
minimap, v4.24.3
minimap-highlight-selected, v4.4.0
open-recent, v5.0.0
python-tools, v0.6.7
rst-preview-pandoc, v0.1.12
symbol-gen, v1.3.0
symbols-tree-view, v0.13.2
table-editor, v0.2.0

# Dev
No dev packages
bobek commented 8 years ago

I have the same issue with Atom version 1.9.8 and package version 0.2.0

zk4 commented 7 years ago

I think it`s still not fixed. version 0.2.1 atom 1.10.2

TypeError: Cannot read property 'length' of null
    at /Users/zk/.atom/packages/table-editor/lib/table-processors.coffee:105:42
    at Object.exports.parseString (/Users/zk/.atom/packages/table-editor/node_modules/asciiparse/index.js:112:3)
    at processMarkdownTable (/Users/zk/.atom/packages/table-editor/lib/table-processors.coffee:85:27)
    at /Users/zk/.atom/packages/table-editor/lib/table-processors.coffee:152:3
    at TableFormatter.module.exports.TableFormatter.getFormattedTableText (/Users/zk/.atom/packages/table-editor/lib/table-formatter.coffee:89:21)
    at TableFormatter.module.exports.TableFormatter.getSelectionRanges (/Users/zk/.atom/packages/table-editor/lib/table-formatter.coffee:152:17)
    at Object.module.exports.TableEditor.formatTable (/Users/zk/.atom/packages/table-editor/lib/table-editor.coffee:199:7)
    at atom-text-editor.subscriptions.add.atom.commands.add.table-editor:next-cell (/Users/zk/.atom/packages/table-editor/lib/table-editor.coffee:33:37)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:580:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:388:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:98:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)
penseleit commented 6 years ago

I suspect this bug has the same root cause as issues #2, #3, #4, and #5: they are all trying to work with a null object.