mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 01:24:05 +02:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user