fix tautological-pointer-compare warnings

Fixes Werror build failures caused by tautological-pointer-compares when building with a custom clang build on OSX.
I don't really get what is going on in this patch.