Fix for-loop bug in image viewer. See #12303 (rebased onto dev_5_0)



This is the same as gh-2552 but rebased onto dev_5_0.

----

Simple bug fix in for-loop. Fixes https://trac.openmicroscopy.org.uk/ome/ticket/12303

To test:
 - Open web full image viewer.
 - Click 'Edit' and make rendering changes.
 - Click 'Apply' - changes appear in viewer
 - Click 'Save' - check that webclient thumbnail is updates, changes are saved etc. (E.g. refresh viewer and check settings are saved).