Fix crash under lb_LU locale
Bug: v8:9642 Change-Id: I2dcd1c0e3c208b15b5c0ec0f08880744134f7474 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1769479 Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#63404}
This commit is contained in:
parent
864cacd65a
commit
b8cdfe5565
@ -8,8 +8,11 @@
|
||||
|
||||
#include "src/objects/js-date-time-format.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "src/date/date.h"
|
||||
@ -1191,6 +1194,12 @@ class DateTimePatternGeneratorCache {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
map_[key].reset(icu::DateTimePatternGenerator::createInstance(
|
||||
icu::Locale(key.c_str()), status));
|
||||
// Fallback to use "root".
|
||||
if (U_FAILURE(status)) {
|
||||
status = U_ZERO_ERROR;
|
||||
map_[key].reset(
|
||||
icu::DateTimePatternGenerator::createInstance("root", status));
|
||||
}
|
||||
CHECK(U_SUCCESS(status));
|
||||
return map_[key]->clone();
|
||||
}
|
||||
|
8
test/intl/regress-9642.js
Normal file
8
test/intl/regress-9642.js
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright 2019 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Environment Variables: LANG=lb_LU
|
||||
// Test creation of Intl.DateTimeFormat under not installed locale.
|
||||
|
||||
let dtf = new Intl.DateTimeFormat();
|
Loading…
Reference in New Issue
Block a user