From 054f1e7e57ac7e2ea476bd7cfa603dc1fee7a520 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 15 Feb 2014 13:46:57 +0100 Subject: [PATCH] Handle undefined url in LinkAnnotation --- src/shared/annotation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/annotation.js b/src/shared/annotation.js index d9aed472f..b8d9ee80a 100644 --- a/src/shared/annotation.js +++ b/src/shared/annotation.js @@ -644,7 +644,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() { if (isName(url)) { // Some bad PDFs do not put parentheses around relative URLs. url = '/' + url.name; - } else { + } else if (url) { url = addDefaultProtocolToUrl(url); } // TODO: pdf spec mentions urls can be relative to a Base @@ -684,7 +684,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() { // Lets URLs beginning with 'www.' default to using the 'http://' protocol. function addDefaultProtocolToUrl(url) { - if (url.indexOf('www.') === 0) { + if (url && url.indexOf('www.') === 0) { return ('http://' + url); } return url;