fix logic error 'array access results in a null pointer dereference' refs #187
small refactoring for fix logic error 'array access results in a null pointer dereference'
Use a weak reference for the delegate.

Fix #78.
Merge pull request #193 from siberianisaev/issue_187

fix logic error 'array access results in a null pointer dereference'
Merge pull request #200 from paulyoung/delegate-weak-reference

Use a weak reference for the delegate.
Merge remote-tracking branch 'upstream/master'