There's a check for `self.shell` being None both where this is called and in its definition.