1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-09-27 16:56:57 +02:00

Don't crash on share when log file does not exist (#1444)

This commit is contained in:
cpfeiffer 2019-02-28 22:04:05 +01:00
parent f3a7861fdb
commit e6ebe8b2bd

View File

@ -321,10 +321,16 @@ public class DebugActivity extends AbstractGBActivity {
private void shareLog() {
String fileName = GBApplication.getLogPath();
if(fileName != null && fileName.length() > 0) {
File logFile = new File(fileName);
if (!logFile.exists()) {
GB.toast("File does not exist", Toast.LENGTH_LONG, GB.INFO);
return;
}
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("*/*");
emailIntent.putExtra(EXTRA_SUBJECT, "Gadgetbridge log file");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(fileName)));
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(logFile));
startActivity(Intent.createChooser(emailIntent, "Share File"));
}
}