-
Notifications
You must be signed in to change notification settings - Fork 468
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
Added missing initialization for entities in SvgNodeReader #519
Conversation
mrbean-bremen
commented
Jul 20, 2019
- prevents crash, fixes NullReferenceException in SvgNodeReader.ResolveEntity when opening SVG with entity definitions #518
- added test
- prevents crash, fixes svg-net#518 - added test
@H1Gdev - please have a look1 |
Source/SvgNodeReader.cs
Outdated
@@ -18,7 +14,11 @@ internal sealed class SvgNodeReader : XmlNodeReader | |||
public SvgNodeReader(XmlNode node, Dictionary<string, string> entities) | |||
: base(node) | |||
{ | |||
this._entities = entities; | |||
_entities = entities; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_entities = entities ?? new Dictionary<string, string>();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks - will change it.
{ | ||
if (this._entities.ContainsKey(this.Name)) | ||
if (_entities.ContainsKey(Name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One possible fix is to change it to an Entities
property, but is there a reason not to do so ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been a property in the first place, and the bug came from not using it. In this case I see no reason for a property - it only adds complexity instead of removing it (being private, not automatic, and both readable and writable).
- prevents crash, fixes #518 - added test
@mrbean-bremen I noticed that somewhere in these commits the netcore 2.2 TargetFramework was removed from the unit test project. Was this intentionally? |
Oops - certainly not! I will check this. |
Thanks - fixed now! |