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

NullReferenceException in ToCss() #129

Closed
mganss opened this issue Jan 23, 2023 · 1 comment
Closed

NullReferenceException in ToCss() #129

mganss opened this issue Jan 23, 2023 · 1 comment
Labels
Milestone

Comments

@mganss
Copy link
Contributor

mganss commented Jan 23, 2023

var html = "<div style=\"border-width:1px;border-right-width:px;\"></div>";
var parser = new HtmlParser(new HtmlParserOptions(), BrowsingContext.New(Configuration.Default.WithCss(new CssParserOptions())));
var dom = parser.ParseDocument(html);
var div = dom.Body?.FirstElementChild;
var style = div.GetStyle();
var css = style.ToCss(); // -> exception

AngleSharp.Css version is 0.17.0.

The combination of property values has to be very specific to trigger the issue. This does not occur if only border-right-width:px is given or border-right-width:1px;border-right-width:px.

This was initially reported as mganss/HtmlSanitizer#426.

@FlorianRappl
Copy link
Contributor

Fixed and will be part of next preview / release (1.0.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants