Skip to content

Commit 45cb46d

Browse files
committed
fix: check for parentNode before calling .meta on it
1 parent 0d23336 commit 45cb46d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

platform/nativescript/renderer/utils.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ export function isContentView(view) {
1515
}
1616

1717
export function insertChild(parentNode, childNode, atIndex = -1) {
18+
if (!parentNode) {
19+
return
20+
}
21+
1822
if (typeof parentNode.meta.insertChild === 'function') {
1923
return parentNode.meta.insertChild(parentNode, childNode, atIndex)
2024
}
2125

22-
if (!parentNode || childNode.meta.skipAddToDom) {
26+
if (childNode.meta.skipAddToDom) {
2327
return
2428
}
2529

@@ -55,11 +59,15 @@ export function insertChild(parentNode, childNode, atIndex = -1) {
5559
}
5660

5761
export function removeChild(parentNode, childNode) {
62+
if (!parentNode) {
63+
return
64+
}
65+
5866
if (typeof parentNode.meta.removeChild === 'function') {
5967
return parentNode.meta.removeChild(parentNode, childNode)
6068
}
6169

62-
if (!parentNode || childNode.meta.skipAddToDom) {
70+
if (childNode.meta.skipAddToDom) {
6371
return
6472
}
6573

0 commit comments

Comments
 (0)