This should be `wxCHECK_MSG()` to ensure that the invalid iterator is not used in the next line below.