Skip to content

Commit

Permalink
Improvement for to validate if the input parameter 'raw.v_votes' is a…
Browse files Browse the repository at this point in the history
… string. Fixes #31
  • Loading branch information
jarenal committed Oct 13, 2017
1 parent 14117c0 commit ccd00de
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions logic/vote.js
Expand Up @@ -359,15 +359,16 @@ Vote.prototype.objectNormalize = function (trs) {
* @return {null|votes} votes object
*/
Vote.prototype.dbRead = function (raw) {
// console.log(raw.v_votes);

if (!raw.v_votes) {
return null;
} else {
var votes = raw.v_votes.split(',');
}

return {votes: votes};
if(typeof raw.v_votes !== 'string') {
return null;
}

var votes = raw.v_votes.split(',');
return {votes: votes};
};

Vote.prototype.dbTable = 'votes';
Expand Down

0 comments on commit ccd00de

Please sign in to comment.