mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 07:39:16 +00:00
ICU-2840 don't crash w/o data
X-SVN-Rev: 12307
This commit is contained in:
parent
ee995c2d81
commit
ad141400ac
3 changed files with 33 additions and 8 deletions
|
@ -60,7 +60,11 @@ DateFormat& DateFormat::operator=(const DateFormat& other)
|
|||
} else {
|
||||
fCalendar = NULL;
|
||||
}
|
||||
fNumberFormat = (NumberFormat*)other.fNumberFormat->clone();
|
||||
if(other.fNumberFormat) {
|
||||
fNumberFormat = (NumberFormat*)other.fNumberFormat->clone();
|
||||
} else {
|
||||
fNumberFormat = NULL;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -88,8 +92,8 @@ DateFormat::operator==(const Format& other) const
|
|||
|
||||
return (this == fmt) ||
|
||||
((getDynamicClassID() == other.getDynamicClassID()) &&
|
||||
fCalendar->isEquivalentTo(*fmt->fCalendar) &&
|
||||
(*fNumberFormat == *fmt->fNumberFormat));
|
||||
fCalendar&&(fCalendar->isEquivalentTo(*fmt->fCalendar)) &&
|
||||
(fNumberFormat&&(*fNumberFormat == *fmt->fNumberFormat)) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -116,7 +116,10 @@ DecimalFormat::DecimalFormat(UErrorCode& status)
|
|||
fNegPrefixPattern(0),
|
||||
fNegSuffixPattern(0),
|
||||
fCurrencyChoice(0),
|
||||
fSymbols(0)
|
||||
fSymbols(0), fFormatWidth(0),
|
||||
fPad(0), fMinExponentDigits(0),
|
||||
fRoundingIncrement(0),fMultiplier(0),
|
||||
fGroupingSize(0),fGroupingSize2(0)
|
||||
{
|
||||
UParseError parseError;
|
||||
construct(status, parseError);
|
||||
|
@ -134,7 +137,10 @@ DecimalFormat::DecimalFormat(const UnicodeString& pattern,
|
|||
fNegPrefixPattern(0),
|
||||
fNegSuffixPattern(0),
|
||||
fCurrencyChoice(0),
|
||||
fSymbols(0)
|
||||
fSymbols(0), fFormatWidth(0),
|
||||
fPad(0), fMinExponentDigits(0),
|
||||
fRoundingIncrement(0),fMultiplier(0),
|
||||
fGroupingSize(0),fGroupingSize2(0)
|
||||
{
|
||||
UParseError parseError;
|
||||
construct(status, parseError, &pattern);
|
||||
|
@ -154,7 +160,10 @@ DecimalFormat::DecimalFormat(const UnicodeString& pattern,
|
|||
fNegPrefixPattern(0),
|
||||
fNegSuffixPattern(0),
|
||||
fCurrencyChoice(0),
|
||||
fSymbols(0)
|
||||
fSymbols(0), fFormatWidth(0),
|
||||
fPad(0), fMinExponentDigits(0),
|
||||
fRoundingIncrement(0),fMultiplier(0),
|
||||
fGroupingSize(0),fGroupingSize2(0)
|
||||
{
|
||||
UParseError parseError;
|
||||
if (symbolsToAdopt == NULL)
|
||||
|
@ -172,7 +181,10 @@ DecimalFormat::DecimalFormat( const UnicodeString& pattern,
|
|||
fNegPrefixPattern(0),
|
||||
fNegSuffixPattern(0),
|
||||
fCurrencyChoice(0),
|
||||
fSymbols(0)
|
||||
fSymbols(0), fFormatWidth(0),
|
||||
fPad(0), fMinExponentDigits(0),
|
||||
fRoundingIncrement(0),fMultiplier(0),
|
||||
fGroupingSize(0),fGroupingSize2(0)
|
||||
{
|
||||
if (symbolsToAdopt == NULL)
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
|
@ -192,7 +204,10 @@ DecimalFormat::DecimalFormat(const UnicodeString& pattern,
|
|||
fNegPrefixPattern(0),
|
||||
fNegSuffixPattern(0),
|
||||
fCurrencyChoice(0),
|
||||
fSymbols(0)
|
||||
fSymbols(0), fFormatWidth(0),
|
||||
fPad(0), fMinExponentDigits(0),
|
||||
fRoundingIncrement(0),fMultiplier(0),
|
||||
fGroupingSize(0),fGroupingSize2(0)
|
||||
{
|
||||
UParseError parseError;
|
||||
construct(status, parseError, &pattern, new DecimalFormatSymbols(symbols));
|
||||
|
|
|
@ -575,11 +575,17 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
|
|||
|
||||
/* In case something goes wrong, initialize all of the data to NULL. */
|
||||
fEras = NULL;
|
||||
fErasCount = 0;
|
||||
fMonths = NULL;
|
||||
fMonthsCount=0;
|
||||
fShortMonths = NULL;
|
||||
fShortMonthsCount=0;
|
||||
fWeekdays = NULL;
|
||||
fWeekdaysCount=0;
|
||||
fShortWeekdays = NULL;
|
||||
fShortWeekdaysCount=0;
|
||||
fAmPms = NULL;
|
||||
fAmPmsCount=0;
|
||||
fZoneStringsRowCount = 0;
|
||||
fZoneStringsColCount = 0;
|
||||
fZoneStrings = NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue