summaryrefslogtreecommitdiff
path: root/modules/abbrgen/abbrgen.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/abbrgen/abbrgen.js')
-rw-r--r--modules/abbrgen/abbrgen.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/abbrgen/abbrgen.js b/modules/abbrgen/abbrgen.js
index 64a29b1..ba6248b 100644
--- a/modules/abbrgen/abbrgen.js
+++ b/modules/abbrgen/abbrgen.js
@@ -13,6 +13,7 @@ function get_abbreviations(abbr,num,cb){
console.log(err.toString());
console.log(err.stack);
cb([]);
+ return;
}
cb(stdout.split("\n"));
});
@@ -38,11 +39,11 @@ module.exports=function(app,io,_moddir){
res.send("ERROR: Number of abbreviations too large.");
return;
}
- if(!abbr.match(/^[a-z]+$/i)||isNaN(+num)){
+ if(!abbr.match(/^[a-z]+$/i)||isNaN(+num)||num<0||num%1!=0){
res.send("ERROR: Invalid input values.");
return;
}
- get_abbreviations(abbr,num,function(answers){
+ get_abbreviations(abbr,num|0,function(answers){
res.send(answers.join("\n"));
});
});