Add null guards
This commit is contained in:
@@ -6,6 +6,9 @@ interface FormattedTextProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FormattedText = ({ children }: FormattedTextProps) => {
|
const FormattedText = ({ children }: FormattedTextProps) => {
|
||||||
|
if (children == null) {
|
||||||
|
children = ''
|
||||||
|
}
|
||||||
const tokens = tokenize(children)
|
const tokens = tokenize(children)
|
||||||
|
|
||||||
return <>{renderTokens(tokens)}</>
|
return <>{renderTokens(tokens)}</>
|
||||||
|
|||||||
@@ -64,7 +64,10 @@ export function formatSubSkillInfo({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function replaceNewLine(value: string = '') {
|
export function replaceNewLine(value: string) {
|
||||||
|
if (value == null) {
|
||||||
|
value = ''
|
||||||
|
}
|
||||||
return value.replace(/\\n/g, '\n')
|
return value.replace(/\\n/g, '\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user