Skip to content

Commit 8032614

Browse files
committed
Make sure the options variable is an object
1 parent dd08458 commit 8032614

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/models/QuestionModel.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export class LinkOption {
7676

7777
export default class QuestionModel {
7878
constructor(options) {
79+
// Make sure the options variable is an object
80+
options = options || {}
81+
7982
this.id = null
8083
this.answer = null
8184
this.answered = false
@@ -134,7 +137,7 @@ export default class QuestionModel {
134137

135138
// Check if we have an answer already (when we have a pre-filled form)
136139
// and set the answered property accordingly
137-
if (!this.required && options && typeof options.answer !== 'undefined') {
140+
if (!this.required && typeof options.answer !== 'undefined') {
138141
this.answered = true
139142
} else if (this.answer && (!this.multiple || this.answer.length)) {
140143
this.answered = true

0 commit comments

Comments
 (0)