Check pointer before dereferencing
And remove over-use of auto. This fixes at least one crash as reported in
CCBUG