Use pointer after checking for NULL.
More pointless NULL checks.
Add some NULL checks.