diff --git a/load/page.js b/load/page.js index bb84d8d..11ab176 100644 --- a/load/page.js +++ b/load/page.js @@ -900,7 +900,7 @@ function Page(debug) { var f = new File(filename); if (! f.exists || ! f.open('rb',true)) { log(LOG_ERROR,'|? File doesnt exist: ['+filename+']'); - return false; + return undefined; } var content = f.read(); @@ -958,7 +958,6 @@ function Page(debug) { log(LOG_ERROR,'|? File doesnt exist: ['+filename+']'); return false; } - var contents = JSON.parse(f.read()); contents.date = f.date; f.close(); @@ -967,6 +966,10 @@ function Page(debug) { if (contents.version === 2) contents.content = this.file_content(FRAMES_HOME+SESSION_EXT+'/'+this.name.toString()+'.'+CONTENT_EXT); + // The content file doesnt exist + if (contents.content === undefined) + return false; + var valid_sauce = false; if (contents.content.substr(-128, 7) === 'SAUCE00') { @@ -1055,7 +1058,7 @@ function Page(debug) { var contents = mb.getContent(msg.number); - if (contents === undefined) + if ((contents === undefined) || (contents.content[SESSION_EXT] === undefined)) return false; contents.content = contents.content[SESSION_EXT]; diff --git a/tools/frame_get.js b/tools/frame_get.js index 0499177..fee06a7 100644 --- a/tools/frame_get.js +++ b/tools/frame_get.js @@ -43,3 +43,7 @@ if (p.get(po)) { } else { writeln('Failed to load:'+argv[0]); } + +writeln('----'); +for (var x in p.raw) + writeln(x+':'+JSON.stringify(p.raw[x])+"\r\n"); diff --git a/tools/frame_import.js b/tools/frame_import.js index f7994bc..09d001f 100644 --- a/tools/frame_import.js +++ b/tools/frame_import.js @@ -27,6 +27,9 @@ p.get(po); var SESSION_EXT = 'vtx'; require('ansitex/load/session/viewdata.js','SESSION_VIEWDATA'); -p.raw = p.file_content(FRAMES_HOME+SESSION_EXT+'/'+po.toString()+'.'+CONTENT_EXT); +var vtx = p.file_content(FRAMES_HOME+SESSION_EXT+'/'+po.toString()+'.'+CONTENT_EXT); + +if (vtx !== undefined) + p.raw = vtx; p.save();