Fixed a NullPointerException

Just to be safe. It fixes the crash with the stack trace below:
http://crashes.to/s/b625413ca16