Do better validation in our ESL/ESD iterators.

Signed-off-by: Peter Jones <pjones@redhat.com>