sparse_disp: check if bad_pts is empty

Check if the bad_pts array is empty before trying to work with it.