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

Avoid null reference when max size is 1 #46

Closed
wants to merge 2 commits into from

Conversation

no23reason
Copy link

Previously, when max size was 1, any additions after the first one
would fail with

TypeError: Cannot set property 'prev' of null

because the evict function did not expect there could be nothing left
in the cache once the evicted item was removed.

This change makes the evict more robust in cases like that.

Inspired by the previous PRs, I split the rebuild into a separate commit.

Previously, when max size was 1, any additions after the first one
would fail with

> TypeError: Cannot set property 'prev' of null

because the `evict` function did not expect there could be nothing left
in the cache once the evicted item was removed.

This change makes the `evict` more robust in cases like that.
avoidwork added a commit that referenced this pull request Feb 13, 2022
@avoidwork avoidwork mentioned this pull request Feb 13, 2022
2 tasks
@avoidwork
Copy link
Owner

Closing this PR and handling the other attribute with #50.

@avoidwork avoidwork closed this Feb 13, 2022
@avoidwork
Copy link
Owner

This is fixed in 8.0.1.

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