From 99f9d622e6053c62069f8fedb05141018fea9fdd Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Tue, 5 May 2015 19:17:16 -0700 Subject: [PATCH] minor fix for sync image rendering. --- lib/widget.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/widget.js b/lib/widget.js index 54c30f9..9abcf45 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -8962,7 +8962,7 @@ Image.prototype.renderImage = function(img, ratio, callback) { var self = this; if (cp.execSync) { - callback = callback || function() {}; + callback = callback || function(err, result) { return result; }; try { return callback(null, this.renderImageSync(img, ratio)); } catch (e) { @@ -9031,7 +9031,7 @@ Image.prototype.clearImage = function(callback) { var self = this; if (cp.execSync) { - callback = callback || function() {}; + callback = callback || function(err, result) { return result; }; try { return callback(null, this.clearImageSync()); } catch (e) { @@ -9094,7 +9094,7 @@ Image.prototype.imageSize = function(callback) { var img = this.file; if (cp.execSync) { - callback = callback || function() {}; + callback = callback || function(err, result) { return result; }; try { return callback(null, this.imageSizeSync()); } catch (e) { @@ -9153,7 +9153,7 @@ Image.prototype.termSize = function(callback) { var self = this; if (cp.execSync) { - callback = callback || function() {}; + callback = callback || function(err, result) { return result; }; try { return callback(null, this.termSizeSync()); } catch (e) { @@ -9212,7 +9212,7 @@ Image.prototype.getPixelRatio = function(callback) { var self = this; if (cp.execSync) { - callback = callback || function() {}; + callback = callback || function(err, result) { return result; }; try { return callback(null, this.getPixelRatioSync()); } catch (e) { @@ -9394,6 +9394,7 @@ Image.prototype.termSizeSync = function(_, recurse) { if (!buf.trim()) { // Bug: w3mimgdisplay will sometimes // output nothing. Try again: + recurse = recurse || 0; if (++recurse === 5) { throw new Error('Term size not determined.'); }