Added catch for uncaught Type Error

Resolved "Uncaught TypeError: Cannot read property 'id' of undefined" with a check for null value of optionLocs[index+1] on line 67.