Fix potentially null references. [0]

I just ran a static analysis thing for the heck of it and made some
quick changes.