Skip to content

Commit 515195a

Browse files
committed
fix vuejs#716 unwatch causing error during destroy
1 parent bcb5e51 commit 515195a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/instance/compile.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,12 @@ exports._destroy = function (remove, deferCleanup) {
143143
this._directives[i]._teardown()
144144
}
145145
// teardown all user watchers.
146+
var watcher
146147
for (i in this._userWatchers) {
147-
this._userWatchers[i].teardown()
148+
watcher = this._userWatchers[i]
149+
if (watcher) {
150+
watcher.teardown()
151+
}
148152
}
149153
// remove reference to self on $el
150154
if (this.$el) {

0 commit comments

Comments
 (0)