
We currently use "array[index]" to test whether an array has an element at index before using it. However nowadays gjs warns about accessing non-existent array elements, so the test itself already produces a warning. Avoid this by checking the array length before using an index to access an element. https://bugzilla.gnome.org/show_bug.cgi?id=781471