From 45da12ad55b37fd9542da71a1dcba6b619e3a862 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 26 Jul 2017 16:19:58 -0400 Subject: [PATCH] catch exception when cannot create temp cam file --- src/Android/Services/DeviceActionService.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Android/Services/DeviceActionService.cs b/src/Android/Services/DeviceActionService.cs index fdae6c891..5e3501dcb 100644 --- a/src/Android/Services/DeviceActionService.cs +++ b/src/Android/Services/DeviceActionService.cs @@ -163,15 +163,19 @@ namespace Bit.Android.Services if(!_cameraPermissionsDenied && hasCameraPermission && hasStorageWritePermission) { - var root = new Java.IO.File(global::Android.OS.Environment.ExternalStorageDirectory, "bitwarden"); - var file = new Java.IO.File(root, "temp_camera_photo.jpg"); - if(!file.Exists()) + try { - file.ParentFile.Mkdirs(); - file.CreateNewFile(); + var root = new Java.IO.File(global::Android.OS.Environment.ExternalStorageDirectory, "bitwarden"); + var file = new Java.IO.File(root, "temp_camera_photo.jpg"); + if(!file.Exists()) + { + file.ParentFile.Mkdirs(); + file.CreateNewFile(); + } + var outputFileUri = global::Android.Net.Uri.FromFile(file); + additionalIntents.AddRange(GetCameraIntents(outputFileUri)); } - var outputFileUri = global::Android.Net.Uri.FromFile(file); - additionalIntents.AddRange(GetCameraIntents(outputFileUri)); + catch(Java.IO.IOException) { } } if(additionalIntents.Count > 0)