Commit b8cdfe55 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

Fix crash under lb_LU locale

Bug: v8:9642
Change-Id: I2dcd1c0e3c208b15b5c0ec0f08880744134f7474
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1769479Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63404}
parent 864cacd6
......@@ -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();
}
......
// 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();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment