Add/fix some trivial null checks
Merge pull request #1253 from lioncash/null

Add/fix some trivial null checks