Explorar o código

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

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
tobiasKaminsky %!s(int64=4) %!d(string=hai) anos
pai
achega
42619191d7

+ 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!");
             }