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) <noreply@anthropic.com>
This commit is contained in:
simoleo89
2026-05-13 21:17:06 +02:00
parent 9ef6983632
commit b01f09c8ea
+4 -1
View File
@@ -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())
{