fix crash when the datasource empty