app_server: Fixed crash if there is no window.