diff --git a/src/common/ipc-helpers.ts b/src/common/ipc-helpers.ts index 63c8b8301e..b63ab9dc89 100644 --- a/src/common/ipc-helpers.ts +++ b/src/common/ipc-helpers.ts @@ -16,7 +16,10 @@ export interface IpcMessageHandler { } export function sendMessage(channel: IpcChannel, ...args: any[]) { - webContents.getFocusedWebContents().send(channel, ...args); + const webContent = webContents.getFocusedWebContents(); + if (webContent) { + webContent.send(channel, ...args); + } } export async function invokeMessage(channel: IpcChannel, ...args: any[]) { diff --git a/src/main/cluster.ts b/src/main/cluster.ts index 5118d7a205..30394785c2 100644 --- a/src/main/cluster.ts +++ b/src/main/cluster.ts @@ -71,14 +71,13 @@ export class Cluster implements ClusterModel { async init(proxyPort: number) { try { this.proxyPort = proxyPort; - this.contextHandler = new ContextHandler(this); - this.kubeconfigManager = new KubeconfigManager(this, this.contextHandler); - this.url = this.getKubeconfig().getCurrentCluster().server; this.proxyUrl = `http://localhost:${proxyPort}`; this.kubeProxyUrl = this.proxyUrl + apiKubePrefix; this.webContentUrl = `http://${this.id}.localhost:${proxyPort}`; + this.contextHandler = new ContextHandler(this); + this.kubeconfigManager = new KubeconfigManager(this, this.contextHandler); await this.refreshStatus(); this.initialized = true;