From 973225738b1d08c9b1fbe5b75b0e457d3dda1968 Mon Sep 17 00:00:00 2001 From: Julian Winkler Date: Tue, 3 Sep 2024 17:52:35 +0200 Subject: [PATCH] LayoutInflater: catch non critical exception in generateLayoutParams --- src/api-impl/android/view/LayoutInflater.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/api-impl/android/view/LayoutInflater.java b/src/api-impl/android/view/LayoutInflater.java index f5346cdf..b527efa5 100644 --- a/src/api-impl/android/view/LayoutInflater.java +++ b/src/api-impl/android/view/LayoutInflater.java @@ -178,12 +178,16 @@ public class LayoutInflater { Slog.v(TAG, "Creating params from root: " + root); // Create layout params that match root, if supplied - params = root.generateLayoutParams(attrs); - params.resolveLayoutDirection(root.getLayoutDirection()); - if (!attachToRoot) { - // Set the layout params for temp if we are not - // attaching. (If we are, we use addView, below) - temp.setLayoutParams(params); + try { + params = root.generateLayoutParams(attrs); + params.resolveLayoutDirection(root.getLayoutDirection()); + if (!attachToRoot) { + // Set the layout params for temp if we are not + // attaching. (If we are, we use addView, below) + temp.setLayoutParams(params); + } + } catch (RuntimeException e) { + Slog.w(TAG, "Exception in generateLayoutParams:", e); } }