- Fixes crash when window is undefined