handle case where cb is undefined

This commit is contained in:
Feross Aboukhadijeh
2016-04-14 16:06:24 -07:00
parent 914d07df03
commit f93685811a

View File

@@ -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()
})