TIMOB-15016 check the array index and return null if the index is invalid

 https://github.com/appcelerator/titanium_mobile/pull/4654