Skip to content

Commit

Permalink
fix: undefined is not an object (evaluating 'onPressed.parameters[0]')
Browse files Browse the repository at this point in the history
  • Loading branch information
ariesclark committed Nov 10, 2024
1 parent 31a9104 commit b2f40b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/templates/main-page/infopush.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ export async function refresh() {
...(onPressed
? {
OpenHelpArticle: (() => {
const articleId = onPressed.parameters![0];
const articleId = onPressed.parameters?.[0];
if (!articleId) return {};

const item = userAll.find(({ id }) => id === articleId);
if (!item) return {};
Expand All @@ -197,10 +198,10 @@ export async function refresh() {
OpenSafetyMenu: {
url: "https://wiki.vrchat.com/wiki/Trust_and_Safety"
},
OpenURL: { url: onPressed!.parameters![0] },
OpenURL: { url: onPressed.parameters?.[0] },
OpenVRCPlusMenu: { url: "https://wiki.vrchat.com/wiki/VRChat+" },
OpenWorldsMenu: {
url: `https://vrchat.com/home/worlds#${onPressed!.parameters![0]}`
url: `https://vrchat.com/home/worlds#${onPressed.parameters?.[0]}`
}
}[onPressed.command as SupportedCommand]
: {})
Expand Down

0 comments on commit b2f40b1

Please sign in to comment.