netsurf: node's attributes can be null

This commit is contained in:
Pierre Tachoire
2025-04-30 15:55:34 +02:00
parent 88f7687646
commit 09fbbc1e17
3 changed files with 16 additions and 15 deletions

View File

@@ -99,7 +99,8 @@ pub const Element = struct {
}
pub fn get_attributes(self: *parser.Element) !*parser.NamedNodeMap {
return try parser.nodeGetAttributes(parser.elementToNode(self));
// An element must have non-nil attributes.
return try parser.nodeGetAttributes(parser.elementToNode(self)) orelse unreachable;
}
pub fn get_innerHTML(self: *parser.Element, state: *SessionState) ![]const u8 {