This line needs to be wrapped in `if (this.viewer) {`