Skip to content

Commit a59c327

Browse files
committed
assert that nodes exist
1 parent 2438a0e commit a59c327

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/browser/dom/element.zig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,13 @@ pub const Element = struct {
249249
// We always get it wrapped like so:
250250
// <html><head></head><body>{ ... }</body></html>
251251
// None of the following can be null.
252-
const html = parser.nodeFirstChild(fragment_node).?;
253-
const body = parser.nodeLastChild(html).?;
252+
const maybe_html = parser.nodeFirstChild(fragment_node);
253+
std.debug.assert(maybe_html != null);
254+
const html = maybe_html.?;
255+
256+
const maybe_body = parser.nodeLastChild(html);
257+
std.debug.assert(maybe_body != null);
258+
const body = maybe_body.?;
254259

255260
const children = try parser.nodeGetChildNodes(body);
256261

0 commit comments

Comments
 (0)