added nullcheck

This commit is contained in:
Jaiveer Katariya
2022-12-07 16:32:52 -05:00
parent 6d9b280d23
commit 1403cdbeae
+2 -1
View File
@@ -43,5 +43,6 @@ export function cleanLabel(label: string): string {
.replace(/[^-A-Za-z0-9_.]/gi, '')
const regex = /([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]/
return regex.exec(removedInvalidChars)[0] || ''
const regexResult = regex.exec(removedInvalidChars) || ['']
return regexResult[0]
}