Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 07e7e05

Browse files
manucorporatdanbucholtz
authored andcommitted
fix(live-server): content.toString() crash (#1288)
1 parent f498382 commit 07e7e05

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/dev-server/http-server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ function serveIndex(req: express.Request, res: express.Response) {
8383
// respond with the index.html file
8484
const indexFileName = path.join(config.wwwDir, process.env[Constants.ENV_VAR_HTML_TO_SERVE]);
8585
fs.readFile(indexFileName, (err, indexHtml) => {
86+
if (!indexHtml) {
87+
Logger.error(`Failed to load index.html`);
88+
res.send('try again later');
89+
return;
90+
}
8691
if (config.useLiveReload) {
8792
indexHtml = injectLiveReloadScript(indexHtml, req.hostname, config.liveReloadPort);
8893
indexHtml = injectNotificationScript(config.rootDir, indexHtml, config.notifyOnConsoleLog, config.notificationPort);

0 commit comments

Comments
 (0)