Add a type guard for the missing case

This commit is contained in:
Jose Cortinas 2024-02-20 08:54:50 -06:00
parent 7a1cfb778a
commit 9d4b73408e

View file

@ -54,6 +54,12 @@ export class Octicon extends React.Component<IOcticonProps, {}> {
)
const scaledSymbol = symbol[naturalHeight]
if (scaledSymbol === undefined) {
// Should never happen, but if it does the app should still be usable
return null
}
const naturalWidth = scaledSymbol.w
const width = height * (naturalWidth / naturalHeight)