diff --git a/res/values/strings.xml b/res/values/strings.xml index d8c5d0566..26b20df4f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -127,7 +127,7 @@ An unexpected error happened that has made group creation fail. You need at least one person in your group! One of the members of your group has a number that can\'t be read correctly. Please fix or remove that contact and try again. - File I/O error, couldn\'t create temporary image file + File I/O error, couldn\'t create a temporary image file. Import System SMS Database? diff --git a/src/org/thoughtcrime/securesms/GroupCreateActivity.java b/src/org/thoughtcrime/securesms/GroupCreateActivity.java index 1deffa6f1..d09de3e76 100644 --- a/src/org/thoughtcrime/securesms/GroupCreateActivity.java +++ b/src/org/thoughtcrime/securesms/GroupCreateActivity.java @@ -238,6 +238,7 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv File f = new File(Environment.getExternalStorageDirectory(), TEMP_PHOTO_FILE); try { f.createNewFile(); + f.deleteOnExit(); } catch (IOException e) { Log.e(TAG, "Error creating new temp file.", e); Toast.makeText(getApplicationContext(), R.string.GroupCreateActivity_file_io_exception, Toast.LENGTH_SHORT).show(); @@ -338,13 +339,13 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv break; case PICK_AVATAR: if(resultCode == RESULT_OK) { - Bundle extras = data.getExtras(); - if (extras != null) { - File tempFile = getTempFile(); - avatarBmp = BitmapFactory.decodeFile(tempFile.getAbsolutePath()); - avatar.setImageBitmap(avatarBmp); - } + File tempFile = getTempFile(); + avatarBmp = BitmapFactory.decodeFile(tempFile.getAbsolutePath()); + if (avatarBmp != null) avatar.setImageBitmap(avatarBmp); + tempFile.delete(); break; + } else { + Log.i(TAG, "Avatar selection result was not RESULT_OK."); } } }