From b2f67cfcce18d4ed77cb036fbb2bf96ec93d40eb Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 22 Feb 2012 10:35:22 -0800 Subject: [PATCH] don't try to send without an address. Fixes an occasional assertion failure. --- .../src/org/eehouse/android/xw4/BTService.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java index 89b65be3d..c9dd12500 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BTService.java @@ -968,11 +968,17 @@ public class BTService extends Service { public int transportSend( byte[] buf, final CommsAddrRec addr, int gameID ) { - Assert.assertNotNull( addr ); - m_sender.add( new BTQueueElem( BTCmd.MESG_SEND, buf, - addr.bt_hostName, addr.bt_btAddr, - gameID ) ); - return buf.length; + int sent = -1; + if ( null != addr ) { + m_sender.add( new BTQueueElem( BTCmd.MESG_SEND, buf, + addr.bt_hostName, + addr.bt_btAddr, gameID ) ); + sent = buf.length; + } else { + DbgUtils.logf( "BTMsgSink.transportSend: " + + "addr null so not sending" ); + } + return sent; } public boolean relayNoConnProc( byte[] buf, String relayID )