[FIX] fix dereference of iterator

- vector iterator front() is not dereferencable if vector is empty
- thanks to @aiche for finding the error!