From 529ee0bb76a745bf7871ab92d6c60e8c248acc50 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 22 Jun 2017 11:19:32 -0700 Subject: [PATCH] Catch exceptions during invocations of updateSemantics from native code (flutter/engine#3813) --- .../platform/android/io/flutter/view/FlutterView.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java index b657aafb8e..62e0fbfc8e 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/FlutterView.java @@ -681,10 +681,15 @@ public class FlutterView extends SurfaceView } } + // Called by native to update the semantics/accessibility tree. private void updateSemantics(ByteBuffer buffer, String[] strings) { - if (mAccessibilityNodeProvider != null) { - buffer.order(ByteOrder.LITTLE_ENDIAN); - mAccessibilityNodeProvider.updateSemantics(buffer, strings); + try { + if (mAccessibilityNodeProvider != null) { + buffer.order(ByteOrder.LITTLE_ENDIAN); + mAccessibilityNodeProvider.updateSemantics(buffer, strings); + } + } catch (Exception ex) { + Log.e(TAG, "Uncaught exception while updating semantics", ex); } }