fix mem access bug of invalid iterator
fix mem access bug of invalid iterator

Not sure where the bug came from, but valgrind said there was an invalid read on the old code

Ultimaker/CuraEngine,Ultimaker/CuraEngine