pleonex / atom-autocomplete-xml

Autcomplete XML package for Atom editor.
https://atom.io/packages/autocomplete-xml
MIT License
13 stars 8 forks source link

Uncaught TypeError: Cannot read property '$' of null #13

Closed tortechnocom closed 8 years ago

tortechnocom commented 8 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.5.4 System: Ubuntu 14.04.2 Thrown From: autocomplete-xml package, v0.8.2

Stack Trace

Uncaught TypeError: Cannot read property '$' of null

At events.js:141

TypeError: Cannot read property '$' of null
    at Object.module.exports.initTypeObject (/home/tor/.atom/packages/autocomplete-xml/lib/xsdParser.coffee:110:20)
    at Object.module.exports.parseRoot (/home/tor/.atom/packages/autocomplete-xml/lib/xsdParser.coffee:285:13)
    at Object.module.exports.parse (/home/tor/.atom/packages/autocomplete-xml/lib/xsdParser.coffee:66:6)
    at /home/tor/.atom/packages/autocomplete-xml/lib/xsdParser.coffee:44:45
    at Parser.<anonymous> (/home/tor/.atom/packages/autocomplete-xml/node_modules/xml2js/lib/xml2js.js:483:18)
    at emitOne (events.js:77:13)
    at Parser.emit (events.js:169:7)
    at Object.onclosetag (/home/tor/.atom/packages/autocomplete-xml/node_modules/xml2js/lib/xml2js.js:444:26)
    at emit (/home/tor/.atom/packages/autocomplete-xml/node_modules/xml2js/node_modules/sax/lib/sax.js:639:35)
    at emitNode (/home/tor/.atom/packages/autocomplete-xml/node_modules/xml2js/node_modules/sax/lib/sax.js:644:5)
    at closeTag (/home/tor/.atom/packages/autocomplete-xml/node_modules/xml2js/node_modules/sax/lib/sax.js:903:7)
    at Object.write (/home/tor/.atom/packages/autocomplete-xml/node_modules/xml2js/node_modules/sax/lib/sax.js:1447:13)
    at Parser.exports.Parser.Parser.parseString (/home/tor/.atom/packages/autocomplete-xml/node_modules/xml2js/lib/xml2js.js:502:31)
    at Parser.parseString (/home/tor/.atom/packages/autocomplete-xml/node_modules/xml2js/lib/xml2js.js:7:59)
    at Object.exports.parseString (/home/tor/.atom/packages/autocomplete-xml/node_modules/xml2js/lib/xml2js.js:534:19)
    at Object.module.exports.parseFromString (/home/tor/.atom/packages/autocomplete-xml/lib/xsdParser.coffee:39:12)
    at Object.module.exports.parseFromString (/home/tor/.atom/packages/autocomplete-xml/lib/xsd.coffee:50:15)
    at IncomingMessage.<anonymous> (/home/tor/.atom/packages/autocomplete-xml/lib/xsd.coffee:30:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:893:12)
    at doNTCallback2 (node.js:441:9)
    at process._tickCallback (node.js:355:17)

Commands

     -4:10.9.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -3:53 git-plus:menu (atom-text-editor.editor.is-focused)
  6x -3:50.7.0 core:backspace (atom-text-editor.editor.mini.is-focused)
  2x -3:47.3.0 core:move-down (atom-text-editor.editor.mini.is-focused)
     -3:46.3.0 core:move-up (atom-text-editor.editor.mini.is-focused)
     -3:46 core:confirm (atom-text-editor.editor.mini.is-focused)
     -1:14 editor:newline (atom-text-editor.editor.is-focused)
     -0:48.7.0 core:backspace (atom-text-editor.editor.is-focused)
 29x -0:42.9.0 core:undo (atom-text-editor.editor.is-focused)
  3x -0:40.8.0 core:save (atom-text-editor.editor.is-focused)
     -0:37.7.0 symbols-view:toggle-project-symbols (atom-text-editor.editor.is-focused)
  2x -0:35.3.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -0:29.5.0 command-palette:toggle (atom-text-editor.editor.is-focused)
 10x -0:25.9.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -0:06.6.0 fuzzy-finder:toggle-file-finder (atom-text-editor.editor.is-focused)
  3x -0:03.6.0 core:backspace (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {}
}

Installed Packages

# User
autocomplete-xml, v0.8.2
git-plus, v5.13.0

# Dev
No dev packages
pleonex commented 8 years ago

I am not sure why this is happening (I would need to check your XSD file) but I have added robustness to avoid the crash.

pleonex commented 8 years ago

This could happen when a root element type is a built-in type like string or integers. Fixed in v0.9.2