Fixed crash bug when query returns empty result.