Browse Source

Merge pull request #7993 from nextcloud/noAvatars

user search: when reusing temp file, we first need to delete it
Andy Scherzinger 4 years ago
parent
commit
ce4a8159b6

+ 5 - 0
src/main/java/com/owncloud/android/providers/UsersAndGroupsSearchProvider.java

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