mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-6132 Check for fmt null pointer.
X-SVN-Rev: 23197
This commit is contained in:
parent
a9d9611f99
commit
eb896f7b9e
1 changed files with 13 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2004-2006, International Business Machines
|
||||
* Copyright (c) 2004-2008, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
|
@ -28,7 +28,9 @@ CurrencyFormat::CurrencyFormat(const CurrencyFormat& other) :
|
|||
}
|
||||
|
||||
CurrencyFormat::~CurrencyFormat() {
|
||||
delete fmt;
|
||||
if (fmt != NULL) {
|
||||
delete fmt;
|
||||
}
|
||||
}
|
||||
|
||||
UBool CurrencyFormat::operator==(const Format& other) const {
|
||||
|
@ -50,13 +52,20 @@ UnicodeString& CurrencyFormat::format(const Formattable& obj,
|
|||
UnicodeString& appendTo,
|
||||
FieldPosition& pos,
|
||||
UErrorCode& ec) const {
|
||||
return fmt->format(obj, appendTo, pos, ec);
|
||||
if (fmt != NULL) {
|
||||
return fmt->format(obj, appendTo, pos, ec);
|
||||
}
|
||||
// Set error code
|
||||
ec = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return appendTo;
|
||||
}
|
||||
|
||||
void CurrencyFormat::parseObject(const UnicodeString& source,
|
||||
Formattable& result,
|
||||
ParsePosition& pos) const {
|
||||
fmt->parseCurrency(source, result, pos);
|
||||
if (fmt != NULL) {
|
||||
fmt->parseCurrency(source, result, pos);
|
||||
}
|
||||
}
|
||||
|
||||
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CurrencyFormat)
|
||||
|
|
Loading…
Add table
Reference in a new issue