Index: source/i18n/fpositer.cpp |
diff --git a/source/i18n/fpositer.cpp b/source/i18n/fpositer.cpp |
index 3481252a6e3b2bb05d29665c258d044642064580..eb405f9c348ccf620a82b78b2efa52072fe95e00 100644 |
--- a/source/i18n/fpositer.cpp |
+++ b/source/i18n/fpositer.cpp |
@@ -1,3 +1,5 @@ |
+// Copyright (C) 2016 and later: Unicode, Inc. and others. |
+// License & terms of use: http://www.unicode.org/copyright.html |
/* |
****************************************************************************** |
* Copyright (C) 2009-2012, International Business Machines Corporation and |
@@ -60,7 +62,10 @@ void FieldPositionIterator::setData(UVector32 *adopt, UErrorCode& status) { |
// Verify that adopt has valid data, and update status if it doesn't. |
if (U_SUCCESS(status)) { |
if (adopt) { |
- if ((adopt->size() % 3) != 0) { |
+ if (adopt->size() == 0) { |
+ delete adopt; |
+ adopt = NULL; |
+ } else if ((adopt->size() % 3) != 0) { |
status = U_ILLEGAL_ARGUMENT_ERROR; |
} else { |
for (int i = 1; i < adopt->size(); i += 3) { |