Small improvement

This commit is contained in:
M66B 2019-03-21 19:58:00 +00:00
parent 123b979aba
commit c8dc7d3915
3 changed files with 3 additions and 5 deletions

View File

@ -1530,7 +1530,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
DB db = DB.getInstance(context);
EntityAttachment attachment = db.attachment().getAttachment(id);
if (attachment == null)
throw new FileNotFoundException();
return null;
File file = attachment.getFile(context);
ParcelFileDescriptor pfd = null;

View File

@ -38,7 +38,6 @@ import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@ -174,7 +173,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
DB db = DB.getInstance(context);
EntityAttachment attachment = db.attachment().getAttachment(id);
if (attachment == null)
throw new FileNotFoundException();
return null;
db.attachment().setDownloaded(id, null);
attachment.getFile(context).delete();
db.attachment().deleteAttachment(id);

View File

@ -27,7 +27,6 @@ import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
@ -712,7 +711,7 @@ public class MessageHelper {
AttachmentPart apart = attachments.get(index);
EntityAttachment attachment = db.attachment().getAttachment(id);
if (attachment == null)
throw new FileNotFoundException();
return;
File file = attachment.getFile(context);
// Download attachment