mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-01 06:19:57 +01:00
don't crash if for some reason json file can't be written
This commit is contained in:
parent
6789a64b68
commit
e719c6e61d
1 changed files with 11 additions and 7 deletions
|
@ -533,18 +533,22 @@ public class GameUtils {
|
|||
intent.putExtra( Intent.EXTRA_SUBJECT, subject );
|
||||
intent.putExtra( Intent.EXTRA_TEXT, Html.fromHtml(message) );
|
||||
|
||||
File attach = null;
|
||||
File tmpdir = XWApp.ATTACH_SUPPORTED ?
|
||||
DictUtils.getDownloadDir( context ) : null;
|
||||
if ( null == tmpdir ) { // no attachment
|
||||
if ( null != tmpdir ) { // no attachment
|
||||
attach = makeJsonFor( tmpdir, room, inviteID, lang,
|
||||
dict, nPlayers );
|
||||
}
|
||||
|
||||
if ( null == attach ) { // no attachment
|
||||
intent.setType( "message/rfc822");
|
||||
} else {
|
||||
intent.setType( context.getString( R.string.invite_mime ) );
|
||||
|
||||
File attach = makeJsonFor( tmpdir, room, inviteID, lang,
|
||||
dict, nPlayers );
|
||||
String mime = context.getString( R.string.invite_mime );
|
||||
intent.setType( mime );
|
||||
Uri uri = Uri.fromFile( attach );
|
||||
DbgUtils.logf( "using file uri for attachment: %s",
|
||||
uri.toString() );
|
||||
DbgUtils.logf( "using file uri %s, type %s for attachment",
|
||||
uri.toString(), mime );
|
||||
intent.putExtra( Intent.EXTRA_STREAM, uri );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue