Skip to content

fix for bug #4943 - Unregister-PnPHubSite throwing Object reference not set to an instance of an object. #4944

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

Merged
merged 2 commits into from
May 29, 2025

Conversation

reshmee011
Copy link
Contributor

Type

  • Bug Fix

Related Issues?

Fixes #4943

What is in this Pull Request ?

A small check to cater for SiteUrl being null or empty

props = hubSitesProperties.Single(h => !string.IsNullOrEmpty(h.SiteUrl) && h.SiteUrl.Equals(Site.Url, StringComparison.OrdinalIgnoreCase));

@jackpoz
Copy link
Contributor

jackpoz commented May 28, 2025

Does the new code find the props to unregister the hub ? Or does the new code throw another exception as it cannot find a hub with empty url ?

@reshmee011
Copy link
Contributor Author

The CSOM function GetHubSitesProperties() was returning an entry with the Url being null/empty preventing me to do anything related to unregister any hub site. The updated code adds a small check to handle null/empty url values returned by GetHubSitesProperties.

@gautamdsheth gautamdsheth merged commit 3c8cb4f into pnp:dev May 29, 2025
2 checks passed
@gautamdsheth
Copy link
Collaborator

Thanks @reshmee011, good catch , merged it !

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.

[BUG] - Unregister-PnPHubSite throwing Object reference not set to an instance of an object.
3 participants