Skip to content

Commit

Permalink
Fix for (this.value || "").split is not a function
Browse files Browse the repository at this point in the history
If value is not a String, we got an error. 
To fix issue, first convert value to string, then split it.
  • Loading branch information
mosinve committed Apr 5, 2017
1 parent 80080f9 commit 945d536
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/components/form-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
mixins: [formMixin],
computed: {
rowsCount() {
return (this.value || '').split('\n').length;
return (this.value.toString() || '').split('\n').length;

This comment has been minimized.

Copy link
@pi0

pi0 Apr 5, 2017

Member

toString method is not available always on null values or ...

This comment has been minimized.

Copy link
@mosinve

mosinve Apr 5, 2017

Author Member

okay.... what if we change to
(this.value || '').toString().split.... ?

This comment has been minimized.

Copy link
@pi0

pi0 Apr 5, 2017

Member

That would be safer :)

This comment has been minimized.

Copy link
@mosinve

mosinve Apr 5, 2017

Author Member

:) okay

}
},
methods: {
Expand Down

0 comments on commit 945d536

Please sign in to comment.