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 TypeError in the segments update code #1911

Merged
merged 1 commit into from
Jun 2, 2017

Conversation

sheyll
Copy link
Contributor

@sheyll sheyll commented May 4, 2017

No description provided.

@davemevans
Copy link
Contributor

Can you give some background on this? I can't see an associated issue or any way to reproduce?

@sheyll
Copy link
Contributor Author

sheyll commented May 5, 2017

I regularly get:
TypeError: lastSegment is undefined

Now looking at the existing code, I got the impression that in the same function, it checks if segments has more than zero elements, but after that it accesses segments[segments.length - 1] without doing that check.

This I think is wrong, hence this PR.

@davemevans
Copy link
Contributor

Can you share a stream?

@sheyll
Copy link
Contributor Author

sheyll commented May 5, 2017

Sorry I can't share a stream right now.

Have you read the code? Did I miss something? Because it seems so obvious to me that the code was wrong independent of the exact context - unless it was relying on the TypeError in some way.

@davemevans
Copy link
Contributor

It certainly doesn't look great, but this is the first time this has been reported in code which hasn't changed for some time so it would be interesting to see what is causing the segment list to be empty.

Whilst some check may be necessary, it'd be worth deeper consideration around whether simply doing nothing on empty segment list the correct failure behaviour, and whether it is valid for there to be no segments in this particular scenario. This may well be the right fix, but it'd be worth knowing for sure IMO.

@sheyll
Copy link
Contributor Author

sheyll commented May 5, 2017

You are correct in the assesment that this is worth considering deeper.

Anyway, that consideration should not depend on this code remaining broken.

I suggest to create a new issue for that investigatation.

@sheyll
Copy link
Contributor Author

sheyll commented May 30, 2017

Why won't you merge what seems like an obvious bug fix?

@dsparacio
Copy link
Contributor

Sorry we are understaffed. Doing the best we can.

@dsparacio dsparacio merged commit c7c7c65 into Dash-Industry-Forum:development Jun 2, 2017
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.

3 participants