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 crash when not able to load cursor #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

trax44
Copy link

@trax44 trax44 commented Dec 11, 2023

No description provided.

.get_cursor("default")
.expect("Could not load cursor, check XCURSOR_THEME")
.clone();
.get_cursor("default").ok_or(String::from("Could not load cursor, check XCURSOR_THEME"))?;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just return if get_cursor is None, not of create a String that you then ignore. If you want to have an error message, use a log macro like warn!.

mouse.set_cursor(serial, self.cursor_surf.as_ref(), x, y);
},
None => {
_ = self.setup_cursor(wl);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first time this function is run, it will fail to set the cursor even if the cursor is found. In fact, this function didn't need to change to address the error.

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