for-loop fix removes 'undefined' from reset dialog. See #12301

Fixes https://trac.openmicroscopy.org.uk/ome/ticket/12301

To test:
 - open full image viewer, click "Edit" channels then "Reset".
 - Dialog should only have 2 buttons: OK & Cancel.