amirrajan/nodejs-against-humanity — pull request #2 by christothes (2013-12-30 19:28:22+00:00)
Title: Crash in gameViewModel when gameId is an array

When responding to the connectToGame event, the socketIO packet parses the gameId and playerId values as single member arrays.

When gameId is passed to getGame as an array, I was seeing a crash in gameViewModel because the return value was undefined and was being passed to JSON.stringify.

The changes below send gameId as a single value as getGame expects in this scenario. I also just added an error check so that if the _.find still does return undefined for some reason, it will result in an empty object instead of undefined to avoid a crash of the node server.