Fix null pointer in IsTrusted()

Rebased-From: ba51c7d