-
Notifications
You must be signed in to change notification settings - Fork 31
Sulis editor fixes #173
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
Sulis editor fixes #173
Conversation
Something is off with the merge request as I don't see any changes? The most recent commit doesn't have anything to do with the editor? |
Sorry, will fix when I'm at home. |
when changing race the index could become out of bounds Signed-off-by: picobyte <[email protected]>
f9add76
to
2b9d4fe
Compare
Just the #172 fix remains. |
.selected_images | ||
.insert(layer, (index, Rc::clone(&images_ref[index]))); | ||
} | ||
let index = (window.selected_images.get(&layer).unwrap().0 - 1) % len; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because window.selected_images[&layer].0
is a usize, this will cause problems when it is 0. In particular, it panics when running in debug mode, and wraps around in release mode. Even when wrapping, I don't think the wrap around will be to the last entry either, but rather will be what seems like a random entry in the array.
I think the safest bet is to manually check for 0 and set it to len - 1
in this case.
Signed-off-by: picobyte <[email protected]>
Signed-off-by: picobyte <[email protected]>
Good catch, by adding len - 1 this can be solved without branches. |
Fix two issues I noted in the sulis_editor:
an sulis_editor build requirement, mentioned in #169
fire_more_than_once
to default to false, here?and an out of bounds issue #172