davidchambers / tutor

JavaScript interface for the Gatherer card database
https://gatherer.wizards.com/
Do What The F*ck You Want To Public License
149 stars 18 forks source link

Crash with cards with half power #22

Closed pgrosslicht closed 12 years ago

pgrosslicht commented 12 years ago

The server completely crashes if you try to look up an Unhinged card that has half power

For example Gatherer ID: 74244

      _ref = /^([^\/]+?)\s*\/\s*([^\/]+)$/.exec(text).slice(1), power = _ref[0
                                                      ^
TypeError: Cannot call method 'slice' of null
    at Object.common_attrs.stats (tutor/parser.coffee:197:55)
    at Object.exports.card (/tutor/parser.coffee:354:22)
    at Request.exports.fetch_card [as _callback] (tutor/gatherer.coffee:66:21)
    at Request.init.self.callback (tutor/node_modules/request/main.js:120:22)
    at Request.EventEmitter.emit (events.js:91:17)
    at Request.<anonymous> (tutor/node_modules/request/main.js:555:16)
    at Request.EventEmitter.emit (events.js:88:17)
    at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer (tutor/node_modules/request/main.js:517:14)
    at IncomingMessage.EventEmitter.emit (events.js:115:20)
    at IncomingMessage._emitEnd (http.js:366:10)´´´
nicknovitski commented 12 years ago

Thanks for reporting this! I've started a topic branch for the un-set cards.

nicknovitski commented 12 years ago

If you know any cards with fractional toughness, let me know: that seems like the obvious next thing to fix.

pgrosslicht commented 12 years ago

Gatherer ID: 74220 is a 1/3.5

nicknovitski commented 12 years ago

Awesome! Thanks!

It is a shame that gatherer itself doesn't parse the rules text of that card properly: the page's text just says Spells you play cost less to play instead of cost {1/2} less or something...