mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 15:42:14 +00:00
ICU-21940 DateFormatSymbols::assignArray should handle null srcArray
This commit is contained in:
parent
74641a344e
commit
70ed5b4702
1 changed files with 8 additions and 0 deletions
|
@ -314,6 +314,14 @@ DateFormatSymbols::assignArray(UnicodeString*& dstArray,
|
|||
// only from a locale bundle or set via the cloning API,
|
||||
// *and* for as long as all the strings are in *private* fields, preventing
|
||||
// a subclass from creating these strings in an "unsafe" way (with respect to fastCopyFrom()).
|
||||
if(srcArray == nullptr) {
|
||||
// Do not attempt to copy bogus input (which will crash).
|
||||
// Note that this assignArray method already had the potential to return a null dstArray;
|
||||
// see handling below for "if(dstArray != nullptr)".
|
||||
dstCount = 0;
|
||||
dstArray = nullptr;
|
||||
return;
|
||||
}
|
||||
dstCount = srcCount;
|
||||
dstArray = newUnicodeStringArray(srcCount);
|
||||
if(dstArray != nullptr) {
|
||||
|
|
Loading…
Add table
Reference in a new issue