Fix Uncaught TypeError: Cannot call method 'getAttribute' of undefined

https://app.getsentry.com/id/id/group/5151824/