From 7456f5a382fcf5db81655f1de2822e7e624278a5 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 29 Oct 2013 20:59:03 +0000 Subject: [PATCH] ICU-10043 make an error not a crash when reading import rules fails. X-SVN-Rev: 34622 --- icu4c/source/i18n/ucol_tok.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/icu4c/source/i18n/ucol_tok.cpp b/icu4c/source/i18n/ucol_tok.cpp index ca40cc603be..dc20d996582 100644 --- a/icu4c/source/i18n/ucol_tok.cpp +++ b/icu4c/source/i18n/ucol_tok.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2001-2012, International Business Machines +* Copyright (C) 2001-2013, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -2256,6 +2256,16 @@ void ucol_tok_initTokenList( int32_t importRulesLength = 0; const UChar* importRules = importFunc(context, locale, type, &importRulesLength, status); + if (U_FAILURE(*status) || importRules==NULL) { + /** + * This seems to happen when genrb -R is used (#10043). + * Make this an error, not a crash. + */ + if(U_SUCCESS(*status)) { + *status = U_MISSING_RESOURCE_ERROR; + } + return; + } #ifdef DEBUG_FOR_COLL_RULES std::string s; UnicodeString(importRules).toUTF8String(s); -- 2.40.0