Ticket 49529 - Fix Coverity warnings: invalid deferences
Description: So many of the warnings were false positives, but
I "fixed" 90% of them anyway for these two reasons:
One, it's possible that a future change could actually
result in a NULL pointer being referenced.
Two, it would be nice to stop these coverity warnings
so we can focus on real warnings. Auto waivers also
don't always work as the surrounding code changes.
Reviewed by: firstyear (Thanks!)
(cherry picked from commit 7e27face5ef021d883a44d70bb3e9732b115016f)