amirrajan/nodejs-against-humanity — pull request #3 by christothes (2013-12-30 19:52:30+00:00)
Title: Crash in gameViewModel and other places 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 did the same to playerId as well. Smoke tests show no crashes with these changes.

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.