fix bug JOYL-89, array is out of bounds.

array is out of bounds.
Merge pull request #243 from whuthm/ios-style

fix bug JOYL-89, array is out of bounds.