Fix segmentation fault on OS X 10.9 (clang / libc++)

Accessing front() of an empty std::deque is undefined behavior.
With gcc/libstdc++ it seems fine, on clang / libc++ it causes a segmentation fault.