Skip to content

Lightpanda: the headless browser designed for AI and automation

assert node has a non-null document

Karl Seguinfbbfae2d2949
diff --git a/src/browser/webapi/Node.zig b/src/browser/webapi/Node.zig
index 2fd8ec394..2bf956a60 100644
--- a/src/browser/webapi/Node.zig
+++ b/src/browser/webapi/Node.zig
@@ -723,7 +723,9 @@ pub fn getDocument(self: *const Node, frame: *const Frame) *Document {
if (self._type == .document) {
return self.subtype(Document);
}
- return self.ownerDocument(frame).?;
+ const doc = self.ownerDocument(frame);
+ lp.assert(doc != null, "null node document", .{ .type = self.getNodeType() });
+ return doc.?;
}
// Returns the Frame that owns this node's tree, or null when the node's