Commit 7ec607d4 authored by Mike Greiling's avatar Mike Greiling

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

parent 2a7d011a
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
* *
* @param {String} selector * @param {String} selector
*/ */
export default (selector) => { export default selector => {
const link = document.querySelector(selector).getAttribute('href'); const element = document.querySelector(selector);
const link = element && element.getAttribute('href');
if (link) { if (link) {
window.location = 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