When using rawcompare (ssRaw), row1/row2 exceed the number of rows. For example, I have a grid with 3 rows (plus 1 for header), row1 in rawcompare event is 5, but there is no row #5.
Using an array and getdisplaytext to fill the grid, the rawcompare crash because there is no array element with index 5.
Internally, the grid uses a quick sort algorithm. In quick sort, there is a comparison with the mid value but for reasons of efficiency for row swapping, the mid row is temporarily added as extra row in the grid (and comparisons are done against that row)