Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception "cannot read property payload from undefined" #12

Merged
merged 2 commits into from
Feb 4, 2015

Conversation

Giermann
Copy link
Contributor

@Giermann Giermann commented Feb 4, 2015

Unfortunatly I cannot verfy if my coffee syntax is right, but I tried hard to code it right...
I changed my copy in build, which I didn't upload here, since "build" is only the result of coffee.

Without this fix, users randomly reported the given exception. Checking the code I found, that only return of an explicit error or the presence of more than 1 messages is being handled. Return of 0 messages without error would have lead to the exception.

You might consider to increase the version number after applying the patch ;)

@@ -10,8 +10,12 @@ exports.extractValue = (callback) ->
else
messageToUse = messages
debug "message to use",messageToUse
result = messageToUse[0].payload.replace(new RegExp(" ", "g"), "")
callback(error, result)
if messages.length > 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!
Thanks for the pull request. Please keep an eye on the failing travis ci build.
This should be >=1, otherwise results with exaclty one message will result in an error. This is the reason why the travis ci build for this pull request fails.
I will merge the PR when the tests are green.

Regards, Ben

@Giermann
Copy link
Contributor Author

Giermann commented Feb 4, 2015

Sorry, a stupid copy&paste error - of course we have to check 'messageToUse' to have a lenght greater than 0!

benediktarnold added a commit that referenced this pull request Feb 4, 2015
Fix exception "cannot read property payload from undefined"
@benediktarnold benediktarnold merged commit 17ce9aa into njh:master Feb 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants