From e0f94eb0c816eed4df3584dd446cb095607aeb80 Mon Sep 17 00:00:00 2001 From: Gregory Pike Date: Wed, 8 Oct 2014 16:07:12 -0230 Subject: [PATCH] Handle empty filename bug --- lib/DfpUtils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/DfpUtils.js b/lib/DfpUtils.js index 835811a..8b58d1a 100644 --- a/lib/DfpUtils.js +++ b/lib/DfpUtils.js @@ -35,5 +35,9 @@ module.exports.assetByteArray = function (filename) { var fs = require('fs'); var bitmap = fs.readFileSync(filename); + if (!filename) { + return ''; + } + return new Buffer(bitmap).toString('base64'); };