Skip to content

Commit

Permalink
Merge pull request #1622 from ajaxorg/ftp_logger_errors
Browse files Browse the repository at this point in the history
Console/logger shouldnt break when there is no txtConsole
  • Loading branch information
Zef Hemel committed May 30, 2012
2 parents 960c944 + 242ba20 commit d9a78bd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions plugins-client/ext.console/console.js
Expand Up @@ -124,6 +124,10 @@ module.exports = ext.register("ext/console/console", {
},

getLogStreamOutObject: function(tracer_id, idIsPid, originalInput) {
if (typeof tracer_id === "undefined") {
return null;
}

if (idIsPid)
tracer_id = this.pidToTracerMap[tracer_id];
var id = "section" + tracer_id;
Expand Down
17 changes: 14 additions & 3 deletions plugins-client/ext.console/logger.js
Expand Up @@ -110,6 +110,15 @@ document.body.appendChild(preInitOutputBuffer);

// Modify this to create a document fragment if txtOutput is not defined
var getOutputElement = function(getTxtOutput) {

// this is a hack for commands that are not associated with anything
// if this happens we usually write it to `txtConsole`
// but if we don't have that one, we just pump it to /dev/null
// in this case the preInitConsoleBuffer
var defaultHandler = typeof txtConsole !== "undefined" && txtConsole && txtConsole.$ext
? txtConsole.$ext
: preInitOutputBuffer;

if (typeof getTxtOutput === "object" && getTxtOutput && getTxtOutput.$ext && getTxtOutput.id) {
return {
element: getTxtOutput.$ext,
Expand Down Expand Up @@ -139,13 +148,15 @@ var getOutputElement = function(getTxtOutput) {
}
else if (getTxtOutput === "undefined" || !getTxtOutput) {
return {
element: txtConsole.$ext,
element: defaultHandler,
id: "console"
};
}

if (!getTxtOutput.$ext)
getTxtOutput.$ext = txtConsole.$ext;

if (!getTxtOutput.$ext) {
getTxtOutput.$ext = defaultHandler;
}

return {
element: getTxtOutput.$ext,
Expand Down

0 comments on commit d9a78bd

Please sign in to comment.