ICU-6132 Pointers for RBNF and Formattable are check for null.
X-SVN-Rev: 23211
This commit is contained in:
parent
10ad732dbf
commit
2b9c52e17f
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2007, International Business Machines Corporation and *
|
||||
* Copyright (C) 2007-2008, International Business Machines Corporation and *
|
||||
* others. All Rights Reserved. *
|
||||
*******************************************************************************
|
||||
*
|
||||
@ -1244,6 +1244,11 @@ MessageFormat::parse(const UnicodeString& source,
|
||||
ParsePosition tempPos(0);
|
||||
count = 0; // {sfb} reset to zero
|
||||
int32_t len;
|
||||
// If resultArray could not be created, exit out.
|
||||
// Avoid crossing initialization of variables above.
|
||||
if (resultArray == NULL) {
|
||||
goto PARSE_ERROR;
|
||||
}
|
||||
for (int32_t i = 0; i < subformatCount; ++i) {
|
||||
// match up to format
|
||||
len = subformats[i].offset - patternOffset;
|
||||
@ -1396,11 +1401,13 @@ MessageFormat::autoQuoteApostrophe(const UnicodeString& pattern, UErrorCode& sta
|
||||
|
||||
static Format* makeRBNF(URBNFRuleSetTag tag, const Locale& locale, const UnicodeString& defaultRuleSet, UErrorCode& ec) {
|
||||
RuleBasedNumberFormat* fmt = new RuleBasedNumberFormat(tag, locale, ec);
|
||||
if (U_SUCCESS(ec) && defaultRuleSet.length() > 0) {
|
||||
if (fmt == NULL) {
|
||||
ec = U_MEMORY_ALLOCATION_ERROR;
|
||||
} else if (U_SUCCESS(ec) && defaultRuleSet.length() > 0) {
|
||||
fmt->setDefaultRuleSet(defaultRuleSet, ec);
|
||||
if (U_FAILURE(ec)) { // ignore unrecognized default rule set
|
||||
ec = U_ZERO_ERROR;
|
||||
}
|
||||
if (U_FAILURE(ec)) { // ignore unrecognized default rule set
|
||||
ec = U_ZERO_ERROR;
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user