Update functions.php

added check for empty queue