Fix nil reference on error.
Merge pull request #852 from sharetribe/fix-nil-ref-on-error

Fix nil reference on error.