Add bounds check to index access.

Received a number of exceptions from this piece of code
due to `elements` being empty. Add a check for elements
being empty.
Merge branch 'elements_bounds_check' of https://github.com/adamlwgriffiths/python-goose into adamlwgriffiths-elements_bounds_check
Merge branch 'feature/bounds-check-89' into develop