Skip to content

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

Merged
gautamdsheth merged 2 commits into
pnp:devfrom
reshmee011:dev
May 29, 2025
Merged

fix for bug #4943 - Unregister-PnPHubSite throwing Object reference not set to an instance of an object.#4944
gautamdsheth merged 2 commits into
pnp:devfrom
reshmee011:dev

Conversation

@reshmee011
Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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
Copy Markdown
Collaborator 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
Copy Markdown
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