diff --git a/js/privatebin.js b/js/privatebin.js
index c55a0271..65d81878 100644
--- a/js/privatebin.js
+++ b/js/privatebin.js
@@ -2082,7 +2082,8 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
*/
me.hasAttachment = function()
{
- return ($attachmentLink.prop('href') !== '')
+ var link = $attachmentLink.prop('href');
+ return (typeof link !== 'undefined' && link !== '')
}
/**
diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php
index 5381863b..e1df5d7e 100644
--- a/tpl/bootstrap.php
+++ b/tpl/bootstrap.php
@@ -69,7 +69,7 @@ if ($MARKDOWN):
-
+
diff --git a/tpl/page.php b/tpl/page.php
index 18d60e32..c38a1ebb 100644
--- a/tpl/page.php
+++ b/tpl/page.php
@@ -47,7 +47,7 @@ if ($MARKDOWN):
-
+