fix a const iterator

This patch fixes a bug which was reported to Japanese ML (http://osgeo-org.1560.x6.nabble.com/QGIS-td5015613.html). It occurs when graduated style of a hidden layer is saved to QGIS Layer Style File, and causes crash.