Fix error when no compliments are set

This commit is contained in:
rejas 2020-03-15 09:49:32 +01:00
parent e2427fe299
commit 65e1b60fb7

View File

@ -169,12 +169,12 @@ Module.register("compliments", {
index = this.randomIndex(compliments); index = this.randomIndex(compliments);
} }
else{ else{
// no, sequetial // no, sequential
// if doing sequential, don't fall off the end // if doing sequential, don't fall off the end
index = (this.lastIndexUsed >= (compliments.length-1))?0: ++this.lastIndexUsed; index = (this.lastIndexUsed >= (compliments.length-1))?0: ++this.lastIndexUsed;
} }
return compliments[index]; return compliments[index] || "";
}, },
// Override dom generator. // Override dom generator.