summaryrefslogtreecommitdiff
path: root/modules/abbrgen/abbrgen.js
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-01-09 21:01:08 +0100
committertomsmeding <tom.smeding@gmail.com>2017-01-09 21:01:08 +0100
commitea2fba20fc6f537b9224a24ba7a1f923aea045a2 (patch)
treefde8db4fed6e42ced5c796892443ea5c53833c02 /modules/abbrgen/abbrgen.js
parent7aedcb7447f1bfd10d0c12233594ffb1e0473fbd (diff)
abbrgen: Bugfix for negative inputs.....
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"));
});
});