Handle empty filesystem correctly
This commit is contained in:
parent
bd0c20af0a
commit
633013648e
|
@ -214,6 +214,11 @@ function ReadTag(buffer, offset) {
|
|||
|
||||
FS.prototype.OnJSONLoaded = function(fs)
|
||||
{
|
||||
if(DEBUG)
|
||||
{
|
||||
console.assert(fs, "Invalid fs passed to OnJSONLoaded");
|
||||
}
|
||||
|
||||
//console.time("parse");
|
||||
var fsroot = JSON.parse(fs)["fsroot"];
|
||||
//console.timeEnd("parse");
|
||||
|
@ -344,6 +349,8 @@ FS.prototype.LoadFile = function(idx) {
|
|||
// return;
|
||||
//}
|
||||
|
||||
if(this.baseurl)
|
||||
{
|
||||
LoadBinaryResource(this.baseurl + this.GetFullPath(inode.fid),
|
||||
function(buffer){
|
||||
var data = this.inodedata[idx] = new Uint8Array(buffer);
|
||||
|
@ -356,7 +363,12 @@ FS.prototype.LoadFile = function(idx) {
|
|||
this.HandleEvent(idx);
|
||||
}.bind(this),
|
||||
function(error){throw error;});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// If baseurl is not set, we started with an empty filesystem. No files
|
||||
// can be loaded
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
|
|
@ -345,7 +345,7 @@ function V86Starter(options)
|
|||
|
||||
setTimeout(function()
|
||||
{
|
||||
if(settings.fs9p)
|
||||
if(settings.fs9p && settings.fs9p_json)
|
||||
{
|
||||
settings.fs9p.OnJSONLoaded(settings.fs9p_json);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue