use self-documenting null guard

We could use `!== null` here instead, since `typeof undefined` is not `'object'`, but as a general rule I avoid differentiating between null and undefined.

I'm not sure we need the `typeof` here at all now, the `if` is only guarding against trying to read properties in a way that will raise runtime errors.