Check if search results were found before looping through them