node-sprite icon indicating copy to clipboard operation
node-sprite copied to clipboard

in case _getFiles got crash (in sprite.coffee)

Open XenoRoot opened this issue 10 years ago • 0 comments

I got an error when I was going to make spritesheet file. 'uncaught exception' occurred. (can't remember exact condition) In sprite.coffee file, '_getFiles' method made an error.

A simple 'if' check would protect it from error. Code goes below: (sprite.coffee)

104 104       _getFiles: (cb) ->
105 105         fs.readdir "#{@path}/#{@name}", (err, files) ->

106     -         files = files.filter (file) -> file.match /\.(png|gif|jpg|jpeg)$/
    106 +         if not err and files
    107 +           files = files.filter (file) -> file.match /\.(png|gif|jpg|jpeg)$/

107 108           cb err, files

Thanks for your contribution.

XenoRoot avatar Dec 10 '14 08:12 XenoRoot