From f93685811a2f8ef15d5462f40575975f706eeffc Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Thu, 14 Apr 2016 16:06:24 -0700 Subject: [PATCH] handle case where cb is undefined --- renderer/lib/location-history.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/renderer/lib/location-history.js b/renderer/lib/location-history.js index c57cc82f..96efdf0b 100644 --- a/renderer/lib/location-history.js +++ b/renderer/lib/location-history.js @@ -20,7 +20,10 @@ LocationHistory.prototype._go = function (page, cb) { page.onbeforeload((err) => { if (this._pending !== page) return /* navigation was cancelled */ this._pending = null - if (err) return cb(err) + if (err) { + if (cb) cb(err) + return + } this._history.push(page) if (cb) cb() })