davidchambers/tutor

Crash with cards with half power

pgrosslicht opened this issue · 4 comments

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)´´´

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

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

Gatherer ID: 74220 is a 1/3.5

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...