Skip to content

Commit

Permalink
Fixed null issue on source definition
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 28, 2021
1 parent 9d56260 commit 7f22af2
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ export const SourceBase = {

return (formData, errors) => {

console.log(errors)

if (entityIds.indexOf(formData.entityId) > -1) {
errors.entityId.addError('message.id-unique');
}

if (pattern && !pattern.test(formData.entityId)) {
if (pattern && !pattern?.test(formData.entityId)) {
errors.entityId.addError(translator('message.group-pattern-fail', {regex: group?.validationRegex}));
}

Expand All @@ -44,7 +42,7 @@ export const SourceBase = {

if (Array.isArray(formData?.assertionConsumerServices)) {
formData.assertionConsumerServices.forEach((acs, idx) => {
if (!isNil(acs?.locationUrl) && !pattern.test(acs.locationUrl)) {
if (pattern && !isNil(acs?.locationUrl) && !pattern?.test(acs.locationUrl)) {
errors.assertionConsumerServices[idx].locationUrl.addError(translator('message.group-pattern-fail', { regex: group?.validationRegex }))
}
});
Expand Down

0 comments on commit 7f22af2

Please sign in to comment.