mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
29 lines
842 B
C#
29 lines
842 B
C#
using Android.Content;
|
|
using Android.OS;
|
|
using Java.Lang;
|
|
|
|
namespace Bit.Droid.Utilities
|
|
{
|
|
public static class IntentExtensions
|
|
{
|
|
public static void Validate(this Intent intent)
|
|
{
|
|
try
|
|
{
|
|
// Check if getting the bundle of the extras causes any exception when unparcelling
|
|
// Note: getting the bundle like this will cause to call unparcel() internally
|
|
var b = intent?.Extras?.GetBundle("trashstringwhichhasnousebuttocheckunparcel");
|
|
}
|
|
catch (Exception ex) when
|
|
(
|
|
ex is BadParcelableException ||
|
|
ex is ClassNotFoundException ||
|
|
ex is RuntimeException
|
|
)
|
|
{
|
|
intent.ReplaceExtras((Bundle)null);
|
|
}
|
|
}
|
|
}
|
|
}
|