Fix #975

Encountered the above bug on my Mac, Intellij 14 CE with HEAD.

This patch fixes the NPE that I encountered.