NodeFactoryIo / atom-solidity-comments

Atom plugin that generates default comments for solidity contracts based on natspec
3 stars 2 forks source link

Uncaught TypeError: Cannot read property 'trim' of undefined #1

Open ghost opened 5 years ago

ghost commented 5 years ago

When generating comments for a file with existing comments, the plugin throws uncaught exception.

Sample .sol file:

contract SolidityCommentFails {`
  //
  // Long Comment
  //
  function failsOnLongComments() {}
}

Exception: Uncaught TypeError: Cannot read property 'trim' of undefined

TypeError: Cannot read property 'trim' of undefined at ContractComment.hasComment (/home/nikolay/.atom/packages/solidity-comments/node_modules/@nodefactory/solidity-comments-core/dist/lib/contract/contract-comment.js:165:22) at ContractComment.updateComment (/home/nikolay/.atom/packages/solidity-comments/node_modules/@nodefactory/solidity-comments-core/dist/lib/contract/contract-comment.js:46:16) at ContractComment.insertComment (/home/nikolay/.atom/packages/solidity-comments/node_modules/@nodefactory/solidity-comments-core/dist/lib/contract/contract-comment.js:38:16) at Object.visitors.(anonymous function) [as ContractDefinition] (/home/nikolay/.atom/packages/solidity-comments/node_modules/@nodefactory/solidity-comments-core/dist/index.js:52:25) at visit (/home/nikolay/.atom/packages/solidity-comments/node_modules/solidity-parser-antlr/dist/index.js:106:30) at /home/nikolay/.atom/packages/solidity-comments/node_modules/solidity-parser-antlr/dist/index.js:97:14 at Array.forEach () at visit (/home/nikolay/.atom/packages/solidity-comments/node_modules/solidity-parser-antlr/dist/index.js:96:10) at Object.visit (/home/nikolay/.atom/packages/solidity-comments/node_modules/solidity-parser-antlr/dist/index.js:113:7) at generate (/home/nikolay/.atom/packages/solidity-comments/node_modules/@nodefactory/solidity-comments-core/dist/index.js:43:33) at generateCommentsFromText (/home/nikolay/.atom/packages/solidity-comments/node_modules/@nodefactory/solidity-comments-core/dist/index.js:28:10) at Object.run (/home/nikolay/.atom/packages/solidity-comments/lib/atom-solidity-comments.js:29:25) at HTMLElement.atomSolidityCommentsToggle (/home/nikolay/.atom/packages/solidity-comments/lib/atom-solidity-comments.js:19:51) at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app/static/:11:350055) at KeymapManager.t.exports.KeymapManager.dispatchCommandEvent (/usr/share/atom/resources/app/static/:11:1230760) at KeymapManager.t.exports.KeymapManager.handleKeyboardEvent (/usr/share/atom/resources/app/static/:11:1226894) at WindowEventHandler.handleDocumentKeyEvent (/usr/share/atom/resources/app/static/:11:285234)