mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
wrap static Boolean to avoid NPE when uninitialized
This commit is contained in:
parent
da3452f3fa
commit
e2f3963667
1 changed files with 11 additions and 7 deletions
|
@ -267,15 +267,19 @@ public class SMSService extends XWService {
|
|||
}
|
||||
|
||||
private static Intent getIntentTo( Context context, SMSAction cmd )
|
||||
{
|
||||
Intent intent = new Intent( context, SMSService.class );
|
||||
intent.putExtra( CMD_STR, cmd.ordinal() );
|
||||
return intent;
|
||||
}
|
||||
|
||||
private static boolean showToasts( Context context )
|
||||
{
|
||||
if ( null == s_showToasts ) {
|
||||
s_showToasts =
|
||||
XWPrefs.getPrefsBoolean( context, R.string.key_show_sms, false );
|
||||
}
|
||||
|
||||
Intent intent = new Intent( context, SMSService.class );
|
||||
intent.putExtra( CMD_STR, cmd.ordinal() );
|
||||
return intent;
|
||||
return s_showToasts;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -328,7 +332,7 @@ public class SMSService extends XWService {
|
|||
ConnStatusHandler.
|
||||
updateStatusIn( this, null,
|
||||
CommsConnType.COMMS_CONN_SMS, true );
|
||||
if ( s_showToasts && (0 == (m_nReceived % 5)) ) {
|
||||
if ( showToasts( this ) && (0 == (m_nReceived % 5)) ) {
|
||||
DbgUtils.showf( this, "Got msg %d", m_nReceived );
|
||||
}
|
||||
String phone = intent.getStringExtra( PHONE );
|
||||
|
@ -377,7 +381,7 @@ public class SMSService extends XWService {
|
|||
|
||||
private void inviteRemote( String phone, String nliData )
|
||||
{
|
||||
DbgUtils.logf( "inviteRemote()" );
|
||||
DbgUtils.logf( "SMSService.inviteRemote()" );
|
||||
ByteArrayOutputStream bas = new ByteArrayOutputStream( 128 );
|
||||
DataOutputStream das = new DataOutputStream( bas );
|
||||
try {
|
||||
|
@ -684,7 +688,7 @@ public class SMSService extends XWService {
|
|||
DbgUtils.logf( "sendBuffers(): dropping because SMS disabled" );
|
||||
}
|
||||
|
||||
if ( s_showToasts && success && (0 == (s_nSent % 5)) ) {
|
||||
if ( showToasts( this ) && success && (0 == (s_nSent % 5)) ) {
|
||||
DbgUtils.showf( this, "Sent msg %d", s_nSent );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue