fix(arRPC): fix error on null activity (#244)
This commit is contained in:
parent
31ec1ec1b4
commit
1f72a0fc27
1 changed files with 6 additions and 4 deletions
|
@ -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?.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);
|
if (data.activity?.assets?.small_image) data.activity.assets.small_image = await lookupAsset(data.activity.application_id, data.activity.assets.small_image);
|
||||||
|
|
||||||
|
if (data.activity) {
|
||||||
const appId = data.activity.application_id;
|
const appId = data.activity.application_id;
|
||||||
if (!apps[appId]) apps[appId] = await lookupApp(appId);
|
apps[appId] ||= await lookupApp(appId);
|
||||||
|
|
||||||
const app = apps[appId];
|
const app = apps[appId];
|
||||||
if (!data.activity.name) data.activity.name = app.name;
|
data.activity.name ||= app.name;
|
||||||
|
}
|
||||||
|
|
||||||
FluxDispatcher.dispatch({ type: "LOCAL_ACTIVITY_UPDATE", ...data });
|
FluxDispatcher.dispatch({ type: "LOCAL_ACTIVITY_UPDATE", ...data });
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue