From c62df483f4cfd30769aeca6ba9673c192b1d6d61 Mon Sep 17 00:00:00 2001 From: Daniel Engelke Date: Thu, 2 Feb 2017 00:49:15 +0000 Subject: [PATCH] Fix TypeError: (((branch[i].navLabel && branch[i].navLabel.text) || branch[i].navLabel) || "").trim is not a function --- epub.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epub.js b/epub.js index 042eb04..246918f 100644 --- a/epub.js +++ b/epub.js @@ -522,7 +522,8 @@ EPub.prototype.walkNavMap = function (branch, path, id_list, level) { var title = ''; if (branch[i].navLabel && typeof branch[i].navLabel.text == 'string') { - title = branch[i].navLabel.text.trim(); + title = branch[i].navLabel && branch[i].navLabel.text || branch[i].navLabel===branch[i].navLabel ? + '' : (branch[i].navLabel && branch[i].navLabel.text || branch[i].navLabel || "").trim(); } var order = Number(branch[i]["@"] && branch[i]["@"].playOrder || 0); if (isNaN(order)) {