Commit fde6f81
committed
fix(core): guard material-ref parsers against non-string values (Sentry MONOREPO-EDITOR-EM)
getLibraryMaterialIdFromRef and getSceneMaterialIdFromRef only guarded
against null/undefined, then called .startsWith(). When a non-string
material ref reaches them (legacy/malformed wall material slot ref),
.startsWith is undefined -> TypeError: e.startsWith is not a function.
Narrow with typeof !== 'string' -> return null, so a bad ref degrades to
'no library/scene material' instead of throwing during wall material
resolution (packages/viewer wall-materials.ts -> parseMaterialRef).1 parent 5e5b62b commit fde6f81
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4187 | 4187 | | |
4188 | 4188 | | |
4189 | 4189 | | |
4190 | | - | |
| 4190 | + | |
4191 | 4191 | | |
4192 | 4192 | | |
4193 | 4193 | | |
4194 | 4194 | | |
4195 | 4195 | | |
4196 | | - | |
| 4196 | + | |
| 4197 | + | |
4197 | 4198 | | |
4198 | 4199 | | |
4199 | 4200 | | |
| |||
0 commit comments