don't crash on invalid identifiers

fixes a bug where the link button would not be correctly disabled on invalid identifier values

(regression in 7015fae91c)
This commit is contained in:
Martin Raifer
2023-07-17 19:36:25 +02:00
parent ae7d32f7c0
commit 9bd5817ecc
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -195,6 +195,7 @@ export function uiFieldText(field, context) {
window.open(url, '_blank');
}
})
.classed('disabled', () => !validIdentifierValueForLink())
.merge(outlinkButton);
} else if (field.type === 'url') {
input.attr('type', 'text');
@@ -375,7 +376,7 @@ export function uiFieldText(field, context) {
}
}
if (field.type === 'identifier' && field.pattern) {
return value && value.match(new RegExp(field.pattern))[0];
return value && value.match(new RegExp(field.pattern))?.[0];
}
return null;
}