check if queue is empty before calling .front()