Ensure we don't get an index out of bounds exception when attempting to generate transpositions and S1 or S2 is empty.