Skip to content

Commit d61e91b

Browse files
Merge pull request #924 from lightpanda-io/fix-null-owner
node: check owner null before using it
2 parents c453dd2 + 090c0f8 commit d61e91b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/browser/dom/node.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ pub const Node = struct {
206206
// the parent's ownerDocument.
207207
// This process is known as adoption.
208208
// (7.1) https://dom.spec.whatwg.org/#concept-node-insert
209-
if (child_owner == null or (child_owner.? != self_owner.?)) {
209+
if (child_owner == null or (self_owner != null and child_owner.? != self_owner.?)) {
210210
const w = Walker{};
211211
var current = child;
212212
while (true) {
@@ -319,7 +319,7 @@ pub const Node = struct {
319319
// the parent's ownerDocument.
320320
// This process is known as adoption.
321321
// (7.1) https://dom.spec.whatwg.org/#concept-node-insert
322-
if (new_node_owner == null or (new_node_owner.? != self_owner.?)) {
322+
if (new_node_owner == null or (self_owner != null and new_node_owner.? != self_owner.?)) {
323323
const w = Walker{};
324324
var current = new_node;
325325
while (true) {

0 commit comments

Comments
 (0)