user search: when reusing temp file, we first need to delete it

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2021-02-16 09:17:52 +01:00
parent 241ba4104b
commit 42619191d7
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7

View file

@ -406,6 +406,11 @@ public class UsersAndGroupsSearchProvider extends ContentProvider {
// create a file to write bitmap data // create a file to write bitmap data
File f = new File(getContext().getCacheDir(), "test"); File f = new File(getContext().getCacheDir(), "test");
try { try {
if (f.exists()) {
if (!f.delete()) {
throw new IllegalStateException("Existing file could not be deleted!");
}
}
if (!f.createNewFile()) { if (!f.createNewFile()) {
throw new IllegalStateException("File could not be created!"); throw new IllegalStateException("File could not be created!");
} }