mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
avoid NPE by dropping message after test
This commit is contained in:
parent
5ccb9bf7a3
commit
874b479a69
1 changed files with 11 additions and 7 deletions
|
@ -1231,14 +1231,18 @@ public class BTService extends XWService {
|
|||
public int sendViaBluetooth( byte[] buf, int gameID, CommsAddrRec addr )
|
||||
{
|
||||
int nSent = -1;
|
||||
String btAddr = getSafeAddr( addr );
|
||||
if ( null != btAddr && 0 < btAddr.length() ) {
|
||||
m_sender.add( new BTQueueElem( BTCmd.MESG_SEND, buf, btAddr,
|
||||
gameID ) );
|
||||
nSent = buf.length;
|
||||
if ( null == m_sender ) {
|
||||
DbgUtils.logf( "sendViaBluetooth(): no send thread" );
|
||||
} else {
|
||||
DbgUtils.logf( "sendViaBluetooth(): no addr for dev %s",
|
||||
addr.bt_hostName );
|
||||
String btAddr = getSafeAddr( addr );
|
||||
if ( null != btAddr && 0 < btAddr.length() ) {
|
||||
m_sender.add( new BTQueueElem( BTCmd.MESG_SEND, buf, btAddr,
|
||||
gameID ) );
|
||||
nSent = buf.length;
|
||||
} else {
|
||||
DbgUtils.logf( "sendViaBluetooth(): no addr for dev %s",
|
||||
addr.bt_hostName );
|
||||
}
|
||||
}
|
||||
return nSent;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue