File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -147,7 +147,22 @@ DomainId YamlReader::get<DomainId>(
147147{
148148 // Domain id required
149149 DomainId domain;
150- domain.domain_id = get_scalar<DomainIdType>(yml);
150+
151+ // Read as signed integer so negative values can be validated uniformly
152+ // by higher-level configuration checks instead of failing with a YAML cast error
153+ const auto domain_value = get_scalar<long long >(yml);
154+ const auto max_domain_id = static_cast <long long >(DomainId::MAX_DOMAIN_ID );
155+
156+ if (domain_value < 0 || domain_value > max_domain_id)
157+ {
158+ // Mark as invalid and let configuration validation report a clear range error
159+ domain.domain_id = static_cast <DomainIdType>(DomainId::MAX_DOMAIN_ID + 1 );
160+ }
161+ else
162+ {
163+ domain.domain_id = static_cast <DomainIdType>(domain_value);
164+ }
165+
151166 return domain;
152167}
153168
You can’t perform that action at this time.
0 commit comments