Fix a bug where do_in_window crash when there are no results