Skip to content

Check for null when there are no images #370

Merged
merged 1 commit into from Jan 10, 2013

3 participants

@danehammer

if I did something like "hubot image me ablederfl33wo", I would get an error like:

/opt/hubot/scripts/google-images.coffee:47
      images = images.responseData.results;
                                  ^
TypeError: Cannot read property 'results' of null
    at imageMe (/opt/hubot/scripts/google-images.coffee:47:35)
    at IncomingMessage.ScopedClient.request (/opt/hubot/node_modules/hubot/node_modules/scoped-http-client/lib/index.js:61:20)
    at IncomingMessage.EventEmitter.emit (events.js:126:20)
    at IncomingMessage._emitEnd (http.js:366:10)
    at HTTPParser.parserOnMessageComplete as onMessageComplete
    at Socket.socketOnEnd as onend
    at TCP.onread (net.js:418:26)

@danehammer danehammer Check for null when there are no images
if I did something like "hubot image me ablederfl33wo", I would get an error like:

/opt/hubot/scripts/google-images.coffee:47
      images = images.responseData.results;
                                  ^
TypeError: Cannot read property 'results' of null
    at imageMe (/opt/hubot/scripts/google-images.coffee:47:35)
    at IncomingMessage.ScopedClient.request (/opt/hubot/node_modules/hubot/node_modules/scoped-http-client/lib/index.js:61:20)
    at IncomingMessage.EventEmitter.emit (events.js:126:20)
    at IncomingMessage._emitEnd (http.js:366:10)
    at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
    at Socket.socketOnEnd [as onend] (http.js:1356:12)
    at TCP.onread (net.js:418:26)
cfd546f
@boosh
boosh commented Dec 5, 2012

Just experienced this myself. Please pull ASAP :-)

@tombell tombell merged commit 7028ffb into github:master Jan 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.