From d5e3b2fbf0eb21d6acfd79a7bce91436d0e2220f Mon Sep 17 00:00:00 2001
From: Jonas Jenwald <jonas.jenwald@gmail.com>
Date: Sat, 22 Oct 2016 17:44:17 +0200
Subject: [PATCH] Update `PDFOutlineViewer_bindLink` to look more like
 `LinkAnnotationElement_bindLink`

---
 src/display/annotation_layer.js |  2 +-
 web/pdf_outline_viewer.js       | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js
index 88c0c369e..a26382673 100644
--- a/src/display/annotation_layer.js
+++ b/src/display/annotation_layer.js
@@ -299,7 +299,7 @@ var LinkAnnotationElement = (function LinkAnnotationElementClosure() {
         if (this.data.action) {
           this._bindNamedAction(link, this.data.action);
         } else {
-          this._bindLink(link, (this.data.dest || null));
+          this._bindLink(link, this.data.dest);
         }
       }
 
diff --git a/web/pdf_outline_viewer.js b/web/pdf_outline_viewer.js
index 028e7a5ea..84f9c28c1 100644
--- a/web/pdf_outline_viewer.js
+++ b/web/pdf_outline_viewer.js
@@ -90,10 +90,13 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
         });
         return;
       }
-      var linkService = this.linkService;
-      element.href = linkService.getDestinationHash(item.dest);
-      element.onclick = function goToDestination(e) {
-        linkService.navigateTo(item.dest);
+      var self = this, destination = item.dest;
+
+      element.href = self.linkService.getDestinationHash(destination);
+      element.onclick = function () {
+        if (destination) {
+          self.linkService.navigateTo(destination);
+        }
         return false;
       };
     },