miasmos / op.gg-api

Serves op.gg web pages as json.
MIT License
81 stars 21 forks source link

match history does not fail gracefully when summoner has been inactive #1

Closed freakpants closed 9 years ago

freakpants commented 9 years ago

First of all, thanks for taking the time to write this API and upload it. I'm quite happy with it so far as it saved me a lot of potential time. However, i noticed a bug.

When a summoner has been inactive for a long time and has no matches in his history the request to that summoner will crash the server:

parsing http://euw.op.gg/summoner/userName=khiranhi C:\op.gg-api-master\server.js:179 recent.wins = parseInt(temp[2].slice(0,-1)); ^ TypeError: Cannot read property 'slice' of undefined at Request.parseSummoner as _callback at Request.self.callback (C:\op.gg-api-master\node_modules\request\request.j s:237:22) at Request.emit (events.js:110:17) at Request. (C:\op.gg-api-master\node_modules\request\request.js: 1146:14) at Request.emit (events.js:129:20) at IncomingMessage. (C:\op.gg-api-master\node_modules\request\req uest.js:1097:12) at IncomingMessage.emit (events.js:129:20) at _stream_readable.js:908:16

an example summoner: http://euw.op.gg/summoner/userName=mYi+Salor