From ef26576a96697de8b723b700ded1a0d732ef6f5c Mon Sep 17 00:00:00 2001 From: Shane Carr Date: Thu, 3 May 2018 09:02:39 +0000 Subject: [PATCH] ICU-12572 Moving error code check one level deeper such that the constructor does not leave the NumberFormatterImpl in an undefined state for destruction later. X-SVN-Rev: 41316 --- icu4c/source/i18n/number_formatimpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icu4c/source/i18n/number_formatimpl.cpp b/icu4c/source/i18n/number_formatimpl.cpp index 48645a50b82..d8b97044b8b 100644 --- a/icu4c/source/i18n/number_formatimpl.cpp +++ b/icu4c/source/i18n/number_formatimpl.cpp @@ -125,7 +125,6 @@ int32_t NumberFormatterImpl::getPrefixSuffixUnsafe(int8_t signum, StandardPlural } NumberFormatterImpl::NumberFormatterImpl(const MacroProps& macros, bool safe, UErrorCode& status) { - if (U_FAILURE(status)) { return; } fMicroPropsGenerator = macrosToMicroGenerator(macros, safe, status); } @@ -133,6 +132,7 @@ NumberFormatterImpl::NumberFormatterImpl(const MacroProps& macros, bool safe, UE const MicroPropsGenerator* NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe, UErrorCode& status) { + if (U_FAILURE(status)) { return nullptr; } const MicroPropsGenerator* chain = &fMicros; // Check that macros is error-free before continuing. -- 2.40.0