Skip to content
Snippets Groups Projects
Unverified Commit 7ec607d4 authored by Mike Greiling's avatar Mike Greiling
Browse files

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

parent 2a7d011a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment