Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
[IR-2471] studio: avoid crashing app if spec.type is null (#10314)
Browse files Browse the repository at this point in the history
* avoid crashing app if spec.type is null

* add support for .bin files and an UNKNOWN default asset type

---------

Co-authored-by: David Gordon <[email protected]>
  • Loading branch information
dtlehrer and dinomut1 authored Jun 4, 2024
1 parent 384b76f commit 82fb49a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ export const Node: React.FC<NodeUIProps> = ({ id, data, spec, selected, specGene
const pairs = getPairs(spec.inputs, spec.outputs)
const label = spec.label === '' ? data.label : spec.label
return (
<NodeContainer title={label} category={spec.category} selected={selected} isGroup={spec.type === 'group'}>
<NodeContainer
title={label}
category={spec.category}
selected={selected}
isGroup={spec.type ? spec.type === 'group' : false}
>
{pairs.map(([input, output], ix) => (
<div key={ix} className="node-container-row" style={containerRowStyle}>
{input && (
Expand Down
4 changes: 3 additions & 1 deletion packages/engine/src/assets/classes/AssetLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ const getAssetType = (assetFileName: string): AssetType => {
return AssetType.MAT
case 'json':
return AssetType.JSON
case 'bin':
return AssetType.BIN
default:
return null!
return AssetType.UNKNOWN
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/engine/src/assets/enum/AssetType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,7 @@ export enum AssetType {
KTX2 = 'ktx2',
USDZ = 'usdz',
M3U8 = 'm3u8',
MAT = 'material'
MAT = 'material',
BIN = 'binary',
UNKNOWN = 'unknown'
}

0 comments on commit 82fb49a

Please sign in to comment.