-
Notifications
You must be signed in to change notification settings - Fork 25
fixing an undefined case #1
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
Conversation
FIX: Fix crash in `ChangeSet.addSteps`. Issue #1
|
Ah, I screwed up with that loop index magic brinkmanship and the inner loop would sometimes break out while leaving an index at an incorrect position. Attached patch fixes it. Could you verify that it helps? |
|
That definitely does the trick! Presume this'll get published out as a version bump? |
|
Yes, I've released 1.0.1 |
|
I've found another related case of this, but am unable to come up with a great test-case for it. Here's some hopefully helpful evidence I've found: This At that moment, the And the ...happy to collect further info if it feels relevant. A simple |
That shouldn't happen, but I did figure out a case where it does. Does patch 2fc94e7 solve this for you? (That loop is a horror, with all the splicing and side effects it does, but since this is the inner loop of a rather demanding piece of computation, I tried to avoid unnecessary allocations.) |
|
That seems to fix the bug we were seeing! |
|
(I presume that this patch will get published as well?) |
|
It's been released as 1.0.2 |
I'm not sure that I have a clear description of when exactly this bug takes places, because it takes place so deep into the history of documents where we've recorded steps that it's hard to describe exactly what's happening that leads to this, but not infrequently the
let next = inserted[j]line will be undefined, which leads to error later on within this undo cleanup loop. This fix guards against that. I'm realizing that we actually patched this previously, but didn't do so on the prototype, so it's possible this change got lost in the transition to the public module!I was trying to take a stab at developing a test case for this (trying to understand the
findtest harness) but in the interest of time, I figured I'd send this patch your way in case the test case would be relatively simple and I'm just missing something!