coverity#706217 Time of check time of use

Change-Id: I762658a01e97f56b2f9362a38a0fefc941698d1b
coverity#704593 silence Dereference after null check

Change-Id: I3ccd6895a1ddbf46a441e60ceaaaceb945f682e4