From b01f09c8eaa7450683d1f68b24c258b12118845e Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Wed, 13 May 2026 21:17:06 +0200 Subject: [PATCH] fix: null-check the set type before reading .paletteID in avatar editor `buildCategory` was reading `set.paletteID` on the line directly above the `if(!set || !palette) return null` guard. For categories where `getSetType()` legitimately returns null (PETS, MISC with no figure data on the server), this threw "can't access property paletteID, set is null" and triggered the WidgetErrorBoundary when the user opened the avatar editor. Split the guard: bail out as soon as `set` is null, then resolve the palette, then bail again if that's null too. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/hooks/avatar-editor/useAvatarEditor.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hooks/avatar-editor/useAvatarEditor.ts b/src/hooks/avatar-editor/useAvatarEditor.ts index 7ee02b9..098a4ce 100644 --- a/src/hooks/avatar-editor/useAvatarEditor.ts +++ b/src/hooks/avatar-editor/useAvatarEditor.ts @@ -264,9 +264,12 @@ const useAvatarEditorState = () => for(let i = 0; i < MAX_PALETTES; i++) colorItems.push([]); const set = GetAvatarRenderManager().structureData.getSetType(setType); + + if(!set) return null; + const palette = GetAvatarRenderManager().structureData.getPalette(set.paletteID); - if(!set || !palette) return null; + if(!palette) return null; for(const partColor of palette.colors.getValues()) {