diff --git a/lib/net/http_fetch_plugin.js b/lib/net/http_fetch_plugin.js index 806a9c54f4..f6e76aa3f6 100644 --- a/lib/net/http_fetch_plugin.js +++ b/lib/net/http_fetch_plugin.js @@ -109,7 +109,7 @@ shaka.net.HttpFetchPlugin = class { const fetch = shaka.net.HttpFetchPlugin.fetch_; const ReadableStream = shaka.net.HttpFetchPlugin.ReadableStream_; let response; - let arrayBuffer; + let arrayBuffer = new ArrayBuffer(0); let loaded = 0; let lastLoaded = 0; diff --git a/lib/net/http_plugin_utils.js b/lib/net/http_plugin_utils.js index ec8043d684..cf4f23d580 100644 --- a/lib/net/http_plugin_utils.js +++ b/lib/net/http_plugin_utils.js @@ -6,6 +6,7 @@ goog.provide('shaka.net.HttpPluginUtils'); +goog.require('goog.asserts'); goog.require('shaka.log'); goog.require('shaka.util.Error'); goog.require('shaka.util.StringUtils'); @@ -27,6 +28,8 @@ shaka.net.HttpPluginUtils = class { * @return {!shaka.extern.Response} */ static makeResponse(headers, data, status, uri, responseURL, requestType) { + goog.asserts.assert(data, 'Data should be non-null!'); + if (status >= 200 && status <= 299 && status != 202) { // Most 2xx HTTP codes are success cases. /** @type {shaka.extern.Response} */