fix a iteration

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