add defensive code to prevent invalid positions from thowing an error
add defensive code to prevent invalid positions from thowing an error

mbebenita/shumway.ts,mbebenita/shumway.ts,hippich/typescript,fdecampredon/jsx-typescript-old-version,mbebenita/shumway.ts,hippich/typescript,hippich/typescript,fdecampredon/jsx-typescript-old-version,popravich/typescript,fdecampredon/jsx-typescript-old-version,popravich/typescript,popravich/typescript