Skip to content

Check for null before dereference on RootPackage.HomePages#704

Merged
mousetraps merged 1 commit intomicrosoft:masterfrom
mjbvz:RootProject-Homepages-null-deref-fix
Feb 25, 2016
Merged

Check for null before dereference on RootPackage.HomePages#704
mousetraps merged 1 commit intomicrosoft:masterfrom
mjbvz:RootProject-Homepages-null-deref-fix

Conversation

@mjbvz
Copy link
Copy Markdown
Contributor

@mjbvz mjbvz commented Feb 25, 2016

Defect
RootPackage.Homepage can return null to indicate that no root package
exists. This causes two potential null dereferences in DependencyNode.cs

Fix
This fix just adds a null check before accessing the enumerator on the
HomePages property.

RootPackage.Homepage can return null to indicate that no root package
exists. This causes two potential null dereferences in `DependencyNode.cs`

This fix just adds a null check before accessing the enumerator on the
`Homepages` property.
@msftclas
Copy link
Copy Markdown

Hi @mjbvz, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Matt Bierner). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

@mousetraps
Copy link
Copy Markdown
Contributor

👍 - looks fine, though afaik Homepages is never null. Out of curiosity, was specific time when this was not the case, or did you just fix up as you came across it?

@mjbvz
Copy link
Copy Markdown
Contributor Author

mjbvz commented Feb 25, 2016

Debugging new project creation, I was hitting null dereferences in these two locations. I don't know specifically what step of project creation it was in at the time, but the RootPackage.Package property was null, so RootPackage.Homepages was returning null.

@mousetraps
Copy link
Copy Markdown
Contributor

Oh, interesting... good catch!

mousetraps added a commit that referenced this pull request Feb 25, 2016
Check for null before dereference on RootPackage.HomePages
@mousetraps mousetraps merged commit 20e73a9 into microsoft:master Feb 25, 2016
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.

3 participants