]> nmode's Git Repositories - signal-cli/commitdiff
Only attempt to delete profile avatar if it exists
authorAsamK <asamk@gmx.de>
Sat, 13 Feb 2021 14:16:54 +0000 (15:16 +0100)
committerAsamK <asamk@gmx.de>
Sat, 13 Feb 2021 14:16:54 +0000 (15:16 +0100)
Fixes #486

lib/src/main/java/org/asamk/signal/manager/AvatarStore.java
src/main/java/org/asamk/signal/commands/UpdateProfileCommand.java

index b7244ce2193d8ec8a88dd63a3a9329b82b319b61..712e982cadc9c86a6d886a0c477b08ad19091413 100644 (file)
@@ -64,7 +64,9 @@ public class AvatarStore {
     }
 
     private void deleteAvatar(final File avatarFile) throws IOException {
-        Files.delete(avatarFile.toPath());
+        if (avatarFile.exists()) {
+            Files.delete(avatarFile.toPath());
+        }
     }
 
     private File getGroupAvatarFile(GroupId groupId) {
index 35190fe8066dc15fcbbf8a50fa8208e81b23403c..5455f523ab58ac99a16b0c0d04734feea5876df3 100644 (file)
@@ -40,7 +40,7 @@ public class UpdateProfileCommand implements LocalCommand {
                     : avatarPath == null ? null : Optional.of(new File(avatarPath));
             m.setProfile(name, about, aboutEmoji, avatarFile);
         } catch (IOException e) {
-            System.err.println("UpdateAccount error: " + e.getMessage());
+            System.err.println("Update profile error: " + e.getMessage());
             return 3;
         }