]> granicus.if.org Git - icu/commitdiff
ICU-21431 Adds a check to an ICU4C unit test to prevent a segmentation fault
authorgnrunge <nrunge@google.com>
Tue, 8 Dec 2020 18:10:13 +0000 (10:10 -0800)
committerNorbert Runge <41129501+gnrunge@users.noreply.github.com>
Tue, 8 Dec 2020 22:25:42 +0000 (14:25 -0800)
if this test runs without ICU data.

icu4c/source/test/intltest/numfmtst.cpp

index add630a82d0e72ac0877928d6f025c92647677ac..350ef1383cd414f77e7d86a23ba8207f15adf385 100644 (file)
@@ -10069,6 +10069,9 @@ void NumberFormatTest::Test10997_FormatCurrency() {
 
     UErrorCode error = U_ZERO_ERROR;
     NumberFormat* fmt = NumberFormat::createCurrencyInstance(Locale::getUS(), error);
+    if (U_FAILURE(error)) {
+        return;
+    }
     fmt->setMinimumFractionDigits(4);
     fmt->setMaximumFractionDigits(4);