Fix resolveFile on nonexistent paths (#717)

This commit is contained in:
Schuyler Cebulskie
2016-09-19 16:58:15 -04:00
parent afc8e5bee0
commit a2778d4a96

View File

@@ -229,7 +229,7 @@ class ClientDataResolver {
const file = path.resolve(resource);
fs.stat(file, (err, stats) => {
if (err) reject(err);
if (!stats.isFile()) throw new Error(`The file could not be found: ${file}`);
if (!stats || !stats.isFile()) throw new Error(`The file could not be found: ${file}`);
fs.readFile(file, (err2, data) => {
if (err2) reject(err2); else resolve(data);
});