Add missing null checks to map operations