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

Check if GetMenu returns a valid handle and change return type to int for GetMenuItemCount #306

Merged
merged 3 commits into from
Aug 23, 2023

Conversation

Ekopalypse
Copy link
Contributor

@Ekopalypse Ekopalypse commented Aug 21, 2023

This solves the issue that if the menu has been disabled by a user, getMenu returns a NULL pointer and then GetMenuItemCount, returns -1, which is cast to an unsigned int, which then means that it takes a very long time to iterate over non-existent menu items.

Fixes #305

@Ekopalypse
Copy link
Contributor Author

I don't know what I was thinking, but you're right, of course. I can make the changes today after work.

The change was made to match the type of the for loop variable to the value returned by GetMenuItemCount.
@chcg chcg merged commit 75c639d into bruderstein:master Aug 23, 2023
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.

Script hangs when using notepad.runMenuCommand with non-existent menu items
2 participants