[Android] Fix sporadic system crashes
Nicolas Pomepuy
git at videolan.org
Thu Aug 12 11:56:11 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Aug 12 09:49:25 2021 +0200| [6ea5c601f1874ab6c9c47f8d0e53b82ffbb0dc8a] | committer: Nicolas Pomepuy
Fix sporadic system crashes
> https://code.videolan.org/videolan/vlc-android/commit/6ea5c601f1874ab6c9c47f8d0e53b82ffbb0dc8a
---
.../src/org/videolan/vlc/gui/network/MRLPanelFragment.kt | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
index 3b9ff0fa8..08c6a727d 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/network/MRLPanelFragment.kt
@@ -115,9 +115,11 @@ class MRLPanelFragment : Fragment(), View.OnKeyListener, TextView.OnEditorAction
super.onResume()
//Needed after privacy changes made in Android 10
editText.doOnLayout {
- val clipBoardManager = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
- val text = clipBoardManager?.primaryClip?.getItemAt(0)?.text?.toString()
- if (text.isValidUrl()) viewModel.observableSearchText.set(text)
+ try {
+ val clipBoardManager = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager
+ val text = clipBoardManager?.primaryClip?.getItemAt(0)?.text?.toString()
+ if (text.isValidUrl()) viewModel.observableSearchText.set(text)
+ } catch (e: Exception) { }
}
}
More information about the Android
mailing list