Permalink
Browse files

Fix for getImage function

I made a booboo and used an or operator in lieu of an and operator...
  • Loading branch information...
Alcha committed Oct 8, 2018
1 parent f53ae12 commit bade884f7954a08262374aef3cc92daa03ecb94a
Showing with 1 addition and 1 deletion.
  1. +1 −1 util/IOTools.js
@@ -38,7 +38,7 @@ module.exports = class IOTools {
getRandomImage (dirPath, args) {
return new Promise((resolve, reject) => {
this.getImageFilenames(dirPath).then(filenames => {
if (args === undefined || filenames[args[args.length - 1]] !== undefined) resolve(filenames[args.length - 1])
if (args !== undefined && filenames[args[args.length - 1]] !== undefined) resolve(filenames[args.length - 1])
else resolve(filenames[tools.getRandom(0, filenames.length)])
}).catch(err => reject(err))
})

0 comments on commit bade884

Please sign in to comment.