Use try/catch in PageThumbs writeData to deal with null data from caller.

Quick fix for #670
This commit is contained in:
wolfbeast 2018-07-25 12:34:50 +02:00 committed by Roy Tam
commit 49f881cb96

View file

@ -609,7 +609,15 @@ this.PageThumbsStorage = {
writeData: function Storage_writeData(aURL, aData, aNoOverwrite) {
let path = this.getFilePathForURL(aURL);
this.ensurePath();
aData = new Uint8Array(aData);
// XXX: We try/catch here since 'null' isn't accepted until we implement
// ES2017's new Uint8Array(); allowance.
try {
aData = new Uint8Array(aData);
} catch(e) {
aData = new Uint8Array(0);
}
let msg = [
path,
aData,