BigW Consortium Gitlab

fix "Cannot read property 'getAttribute' of null" error

parent 2a7d011a
......@@ -3,8 +3,9 @@
*
* @param {String} selector
*/
export default (selector) => {
const link = document.querySelector(selector).getAttribute('href');
export default selector => {
const element = document.querySelector(selector);
const link = element && element.getAttribute('href');
if (link) {
window.location = link;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment