From a54dc0767a545f5f98e1c2fc08e98efbab1ff35a Mon Sep 17 00:00:00 2001 From: iCrawl Date: Fri, 24 Nov 2017 03:21:27 +0100 Subject: [PATCH] fix: double check if RPC exists or not in commands --- src/extension.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index d34d37d..04e4ad1 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,12 +32,14 @@ export function activate(context: ExtensionContext) { // Register the `discord.enable` command, and set the `enabled` config option to true. const enabler = commands.registerCommand('discord.enable', () => { + if (rpc) return; config.update('enabled', true); initRPC(config.get('clientID')); }); // Register the `discord.disable` command, and set the `enabled` config option to false. const disabler = commands.registerCommand('discord.disable', () => { + if (!rpc) return; config.update('enabled', false); eventHandler.dispose(); rpc.setActivity({});