Fix potential null deref with method logging.