Small improvement

pull/159/head
M66B 6 years ago
parent b306bd1eff
commit 13896fc72a

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

Loading…
Cancel
Save