Small improvement

This commit is contained in:
M66B
2019-07-24 10:43:32 +02:00
parent b306bd1eff
commit 13896fc72a

View File

@@ -119,10 +119,13 @@ public class EntityAttachment {
static void copy(Context context, long oldid, long newid) {
DB db = DB.getInstance(context);
List<EntityAttachment> attachments = db.attachment().getAttachments(oldid);
for (EntityAttachment attachment : attachments) {
File source = attachment.getFile(context);
long aid = attachment.id;
attachment.id = null;
attachment.message = newid;
attachment.progress = null;
@@ -134,6 +137,7 @@ public class EntityAttachment {
Helper.copy(source, target);
} catch (IOException ex) {
Log.e(ex);
db.attachment().setError(aid, Helper.formatThrowable(ex, false));
db.attachment().setError(attachment.id, Helper.formatThrowable(ex, false));
}
}