Add a check on the initial files array.

On Mac this function gets call on launch with an empty files array. So we need to make sure that we're not accessing an item from the empty array.