mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-12 18:57:36 +01:00
Don't crash on share when log file does not exist (#1444)
This commit is contained in:
parent
f3a7861fdb
commit
e6ebe8b2bd
@ -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"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user