Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve a crash for getting timezone (uplift to 1.74.x) #26596

Open
wants to merge 1 commit into
base: 1.74.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/**
* Copyright (c) 2021 The Brave Authors. All rights reserved.
/* Copyright (c) 2021 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */

package org.chromium.chrome.browser.vpn.utils;

import android.app.Activity;
import android.text.TextUtils;
import android.util.Pair;

import androidx.lifecycle.LiveData;
Expand Down Expand Up @@ -66,15 +63,16 @@ public static void handleOnGetTimezonesForRegions(Activity activity,
BraveVpnServerRegion braveVpnServerRegion =
BraveVpnUtils.getServerRegionForTimeZone(
jsonTimezones, TimeZone.getDefault().getID());
String regionFromTimeZone = braveVpnServerRegion.getRegionName();
if (TextUtils.isEmpty(regionFromTimeZone)) {
if (braveVpnServerRegion == null || braveVpnServerRegion.getRegionName().isEmpty()) {
BraveVpnUtils.showToast(
String.format(
activity.getResources()
.getString(R.string.couldnt_get_matching_timezone),
TimeZone.getDefault().getID()));
BraveVpnUtils.dismissProgressDialog();
return;
}
String regionFromTimeZone = braveVpnServerRegion.getRegionName();
String regionForHostName = regionFromTimeZone;
String regionPrecision = braveVpnServerRegion.getRegionPrecision();

Expand Down
Loading