fix crash on start in WebStorm

this is happening when there is no window context
See https://youtrack.jetbrains.com/issue/WEB-14378