From 40a1781a53da2b367b1c77f3bcdde8aa8de262ad Mon Sep 17 00:00:00 2001 From: eight Date: Sat, 7 Oct 2017 18:04:37 +0800 Subject: [PATCH] Fix: TypeError when missing author meta --- install-usercss/install-usercss.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/install-usercss/install-usercss.js b/install-usercss/install-usercss.js index 68c8196e..5676f2c7 100644 --- a/install-usercss/install-usercss.js +++ b/install-usercss/install-usercss.js @@ -70,9 +70,13 @@ $('.meta-version').textContent = data.version; $('.meta-description').textContent = data.description; - $('.meta-author').parentNode.style.display = data.author ? '' : 'none'; - $('.meta-author').textContent = ''; - $('.meta-author').appendChild(makeAuthor(data.author)); + if (data.author) { + $('.meta-author').parentNode.style.display = ''; + $('.meta-author').textContent = ''; + $('.meta-author').appendChild(makeAuthor(data.author)); + } else { + $('.meta-author').parentNode.style.display = 'none'; + } $('.meta-license').parentNode.style.display = data.license ? '' : 'none'; $('.meta-license').textContent = data.license;