mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-21 12:40:02 +00:00
ICU-11452 Improve null check
X-SVN-Rev: 36981
This commit is contained in:
parent
c65976304f
commit
7dff411df7
1 changed files with 4 additions and 1 deletions
|
@ -328,6 +328,9 @@ class SimpleDateFormatMutableNFs : public UMemory {
|
|||
// NumberFormat objects. On memory allocation error returns NULL.
|
||||
// Caller must check for NULL return value.
|
||||
NumberFormat *get(const NumberFormat *nf) {
|
||||
if (nf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
int32_t idx = 0;
|
||||
while (nodes[idx].value) {
|
||||
if (nf == nodes[idx].key) {
|
||||
|
@ -337,7 +340,7 @@ class SimpleDateFormatMutableNFs : public UMemory {
|
|||
}
|
||||
U_ASSERT(idx < UDAT_FIELD_COUNT);
|
||||
nodes[idx].key = nf;
|
||||
nodes[idx].value = (nf == NULL) ? NULL : (NumberFormat *) nf->clone();
|
||||
nodes[idx].value = (NumberFormat *) nf->clone();
|
||||
return nodes[idx].value;
|
||||
}
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue