diff --git a/lib/rules/no-invalid-v-for.js b/lib/rules/no-invalid-v-for.js
index b9852b576..9b19599a3 100644
--- a/lib/rules/no-invalid-v-for.js
+++ b/lib/rules/no-invalid-v-for.js
@@ -21,6 +21,9 @@ const utils = require('../utils')
* @returns {boolean} `true` if the node is using the variables which are defined by `v-for` directives.
*/
function isUsingIterationVar (node) {
+ if (node.value == null) {
+ return false
+ }
const references = node.value.references
const variables = node.parent.parent.variables
diff --git a/tests/lib/rules/no-invalid-v-for.js b/tests/lib/rules/no-invalid-v-for.js
index 861197737..f465b567c 100644
--- a/tests/lib/rules/no-invalid-v-for.js
+++ b/tests/lib/rules/no-invalid-v-for.js
@@ -144,6 +144,11 @@ tester.run('no-invalid-v-for', rule, {
filename: 'test.vue',
code: '
',
errors: ["Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive."]
+ },
+ {
+ filename: 'test.vue',
+ code: '',
+ errors: ["Expected 'v-bind:key' directive to use the variables which are defined by the 'v-for' directive."]
}
]
})