Return before foreach if there is no data found. #1919