avoid NPE by dropping message after test

This commit is contained in:
Eric House 2016-02-02 20:54:35 -08:00
parent 5ccb9bf7a3
commit 874b479a69

View file

@ -1231,14 +1231,18 @@ public class BTService extends XWService {
public int sendViaBluetooth( byte[] buf, int gameID, CommsAddrRec addr ) public int sendViaBluetooth( byte[] buf, int gameID, CommsAddrRec addr )
{ {
int nSent = -1; int nSent = -1;
String btAddr = getSafeAddr( addr ); if ( null == m_sender ) {
if ( null != btAddr && 0 < btAddr.length() ) { DbgUtils.logf( "sendViaBluetooth(): no send thread" );
m_sender.add( new BTQueueElem( BTCmd.MESG_SEND, buf, btAddr,
gameID ) );
nSent = buf.length;
} else { } else {
DbgUtils.logf( "sendViaBluetooth(): no addr for dev %s", String btAddr = getSafeAddr( addr );
addr.bt_hostName ); 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; return nSent;
} }