Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(985)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java

Issue 2874883002: Fix chrome crash issue when payment modifiers are enabled on android. (Closed)
Patch Set: addressing reviewer comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
index 61164ab434b43ec87f4695ee7747a9ce85f940bc..2962b83425031a518a04f65b36791cad79e50ef8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -857,13 +857,14 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
formatter.format(total.amount.value), false /* isPending */));
mUiShoppingCart.setAdditionalContents(
modifier == null ? null : getLineItems(modifier.additionalDisplayItems));
- mUI.updateOrderSummarySection(mUiShoppingCart);
+ if (mUI != null) mUI.updateOrderSummarySection(mUiShoppingCart);
}
/** @return The first modifier that matches the given instrument, or null. */
@Nullable private PaymentDetailsModifier getModifier(@Nullable PaymentInstrument instrument) {
if (mModifiers == null || instrument == null) return null;
- Set<String> methodNames = instrument.getInstrumentMethodNames();
+ // Makes a copy to ensure it is modifiable.
+ Set<String> methodNames = new HashSet<>(instrument.getInstrumentMethodNames());
methodNames.retainAll(mModifiers.keySet());
return methodNames.isEmpty() ? null : mModifiers.get(methodNames.iterator().next());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698