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 handling of the color cache #1730

Merged
merged 1 commit into from Feb 20, 2014
Merged

Fix handling of the color cache #1730

merged 1 commit into from Feb 20, 2014

Conversation

elemoine
Copy link
Member

When the size of the color cache exceeds the limit we're supposed to delete 25% of the entries. Currently this does not work – the cache keeps growing.

This is because (i++ & 3 === 0) always evaluates to 0 (which is a falsy value). This expression always evaluates to 0 because the === operator has precedence over the & operator.

This PR fixes the bug by using brackets around the i++ & 3 expression.

@fredj
Copy link
Member

fredj commented Feb 20, 2014

nice catch !

elemoine pushed a commit that referenced this pull request Feb 20, 2014
Fix handling of the color cache
@elemoine elemoine merged commit dc5c713 into openlayers:master Feb 20, 2014
@elemoine elemoine deleted the colorcache branch February 20, 2014 12:33
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.

None yet

2 participants