aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCanadaHonk <19228318+CanadaHonk@users.noreply.github.com>2022-11-21 19:40:40 +0000
committerGitHub <noreply@github.com>2022-11-21 20:40:40 +0100
commit1f72a0fc27d8fdfa9b83e51e172a16538cc3e5eb (patch)
tree2a741985c34b7459be01dc0e19265c7070715b06
parent31ec1ec1b4c031ffd0a22bfdc4c2678c19a9ca7e (diff)
downloadVencord-1f72a0fc27d8fdfa9b83e51e172a16538cc3e5eb.tar.gz
Vencord-1f72a0fc27d8fdfa9b83e51e172a16538cc3e5eb.tar.bz2
Vencord-1f72a0fc27d8fdfa9b83e51e172a16538cc3e5eb.zip
fix(arRPC): fix error on null activity (#244)
-rw-r--r--src/plugins/arRPC.tsx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/arRPC.tsx b/src/plugins/arRPC.tsx
index a9b2f3c..081ea48 100644
--- a/src/plugins/arRPC.tsx
+++ b/src/plugins/arRPC.tsx
@@ -70,11 +70,13 @@ export default definePlugin({
if (data.activity?.assets?.large_image) data.activity.assets.large_image = await lookupAsset(data.activity.application_id, data.activity.assets.large_image);
if (data.activity?.assets?.small_image) data.activity.assets.small_image = await lookupAsset(data.activity.application_id, data.activity.assets.small_image);
- const appId = data.activity.application_id;
- if (!apps[appId]) apps[appId] = await lookupApp(appId);
+ if (data.activity) {
+ const appId = data.activity.application_id;
+ apps[appId] ||= await lookupApp(appId);
- const app = apps[appId];
- if (!data.activity.name) data.activity.name = app.name;
+ const app = apps[appId];
+ data.activity.name ||= app.name;
+ }
FluxDispatcher.dispatch({ type: "LOCAL_ACTIVITY_UPDATE", ...data });
};