Index 1 error

You will need to debug your buildOptions() function which is returning the null value for index 1.