Skip to content

Commit bc8f701

Browse files
committed
fix: cannot read property of undefined when destroy vue instance
1 parent bfe988b commit bc8f701

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/extension.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ export function extendVue(Vue) {
4646
cache[key] = null;
4747
// fix memory leaks
4848
if (
49-
this.$vnode.parent.componentOptions.children &&
49+
this.$vnode.parent && this.$vnode.parent.componentOptions && this.$vnode.parent.componentOptions.children &&
5050
Array.isArray(this.$vnode.parent.componentOptions.children)
5151
) {
5252
this.$vnode.parent.componentOptions.children.length = 0
5353
}
54-
if (cache[vmCurrent.$vnode.key]){
54+
if (cache[vmCurrent.$vnode.key] && cache[vmCurrent.$vnode.key].parent && cache[vmCurrent.$vnode.key].parent.componentOptions){
5555
cache[vmCurrent.$vnode.key].parent.componentOptions.children = [cache[vmCurrent.$vnode.key]]
5656
cache[vmCurrent.$vnode.key].parent.elm = cache[vmCurrent.$vnode.key].parent.componentInstance.$el
5757
}

0 commit comments

Comments
 (0)