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

AdvancedGenericMenu.FindParent returns self #364

Closed
LupusInferni315 opened this issue Feb 7, 2023 · 1 comment
Closed

AdvancedGenericMenu.FindParent returns self #364

LupusInferni315 opened this issue Feb 7, 2023 · 1 comment

Comments

@LupusInferni315
Copy link
Contributor

LupusInferni315 commented Feb 7, 2023

The method AdvancedGenericMenu.FindParent

private AdvancedGenericMenuItem FindParent( string name ) {
    string[] paths = name.Split( '/' );
    return FindOrCreateItem( string.Join( "/", paths, 0, paths.Length - 1 ) ); // this join returns the same value as 'name'
}

shoud be this

private AdvancedGenericMenuItem FindParent(string name) {
    string[] paths = name.Split('/');
    if (paths.Length > 1)
        return FindOrCreateItem(string.Join("/", paths, 0, paths.Length - 2));
    return null;
}

as the initial method returns the item itself instead of it's parent.

@LupusInferni315
Copy link
Contributor Author

After reading into that overload of the Join function, I realized it's not a start, end indexes but a start and count.

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

No branches or pull requests

1 participant