mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-22004 Avoid UBSan bug by casting only when success
This commit is contained in:
parent
86cc2b98cb
commit
43f2ae75ca
1 changed files with 4 additions and 1 deletions
|
@ -230,7 +230,10 @@ ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status){
|
|||
}
|
||||
|
||||
measurement = measurementTypeBundleForLocale(localeID, MEASUREMENT_SYSTEM, status);
|
||||
system = (UMeasurementSystem) ures_getInt(measurement, status);
|
||||
int32_t result = ures_getInt(measurement, status);
|
||||
if (U_SUCCESS(*status)) {
|
||||
system = static_cast<UMeasurementSystem>(result);
|
||||
}
|
||||
|
||||
ures_close(measurement);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue