From: Lucas Cimon Date: Wed, 7 Jun 2017 14:08:35 +0000 (+0200) Subject: Fixing "Uncaught TypeError" in shaarli.js - fix #893 X-Git-Tag: v0.9.1~1^2~22^2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=refs%2Fpull%2F894%2Fhead;p=github%2Fshaarli%2FShaarli.git Fixing "Uncaught TypeError" in shaarli.js - fix #893 --- diff --git a/tpl/default/js/shaarli.js b/tpl/default/js/shaarli.js index 4ebb7815..b120c91e 100644 --- a/tpl/default/js/shaarli.js +++ b/tpl/default/js/shaarli.js @@ -418,7 +418,8 @@ window.onload = function () { * * TODO: support error code in the backend for AJAX requests */ - var existingTags = document.querySelector('input[name="taglist"]').value.split(' '); + var tagList = document.querySelector('input[name="taglist"]'); + var existingTags = tagList ? tagList.value.split(' ') : []; var awesomepletes = []; // Display/Hide rename form @@ -515,7 +516,7 @@ window.onload = function () { }); }); - updateAwesompleteList('.rename-tag-input', document.querySelector('input[name="taglist"]').value.split(' '), awesomepletes); + updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes); }; /**