]> granicus.if.org Git - icu/commitdiff
ICU-11389 improve error checking (fix)
authorSteven R. Loomis <srl@icu-project.org>
Thu, 20 Nov 2014 00:50:03 +0000 (00:50 +0000)
committerSteven R. Loomis <srl@icu-project.org>
Thu, 20 Nov 2014 00:50:03 +0000 (00:50 +0000)
X-SVN-Rev: 36760

icu4c/source/i18n/region.cpp

index 6330d27d0677c853c695f4a3285039bcd76fea1a..5b093853571daa5d9be0b27dc33ece1d25570ed1 100644 (file)
@@ -138,17 +138,17 @@ void Region::loadRegionData(UErrorCode &status) {
         r->idStr.extract(0,r->idStr.length(),r->id,sizeof(r->id),US_INV);
         r->type = URGN_TERRITORY; // Only temporary - figure out the real type later once the aliases are known.
 
-        uhash_put(regionIDMap,(void *)&(r->idStr),(void *)r.orphan(),&status);
         Formattable result;
         UErrorCode ps = U_ZERO_ERROR;
         df->parse(r->idStr,result,ps);
         if ( U_SUCCESS(ps) ) {
             r->code = result.getLong(); // Convert string to number
-            uhash_iput(numericCodeMap,r->code,(void *)r,&status);
+            uhash_iput(numericCodeMap,r->code,(void *)r.getAlias(),&status);
             r->type = URGN_SUBCONTINENT;
         } else {
             r->code = -1;
         }
+        uhash_put(regionIDMap,(void *)&(r->idStr),(void *)r.orphan(),&status);
     }