fix db_open index is NULL crash issue