Fix assertion, need to check if it's not null first.