mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
fix crashes when emulator decides it supports Bluetooth
This commit is contained in:
parent
86303475af
commit
e7861dca48
3 changed files with 7 additions and 5 deletions
|
@ -286,7 +286,9 @@ public class BTUtils {
|
||||||
|
|
||||||
public static void gameDied( Context context, String btAddr, int gameID )
|
public static void gameDied( Context context, String btAddr, int gameID )
|
||||||
{
|
{
|
||||||
getPA( btAddr ).addDied( gameID );
|
if ( !TextUtils.isEmpty( btAddr ) ) {
|
||||||
|
getPA( btAddr ).addDied( gameID );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void pingHost( Context context, String btAddr, int gameID )
|
public static void pingHost( Context context, String btAddr, int gameID )
|
||||||
|
|
|
@ -2477,7 +2477,8 @@ public class BoardDelegate extends DelegateBase
|
||||||
&& !XWPrefs.getBTDisabled( m_activity ) ) {
|
&& !XWPrefs.getBTDisabled( m_activity ) ) {
|
||||||
CommsAddrRec[] addrs = XwJNI.comms_getAddrs( m_jniGamePtr );
|
CommsAddrRec[] addrs = XwJNI.comms_getAddrs( m_jniGamePtr );
|
||||||
for ( CommsAddrRec addr : addrs ) {
|
for ( CommsAddrRec addr : addrs ) {
|
||||||
if ( addr.contains( CommsConnType.COMMS_CONN_BT ) ) {
|
if ( addr.contains( CommsConnType.COMMS_CONN_BT )
|
||||||
|
&& !TextUtils.isEmpty(addr.bt_btAddr) ) {
|
||||||
BTUtils.pingHost( m_activity, addr.bt_btAddr, m_gi.gameID );
|
BTUtils.pingHost( m_activity, addr.bt_btAddr, m_gi.gameID );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1275,9 +1275,8 @@ public class GameUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( forceNew || !madeGame ) {
|
if ( forceNew || !madeGame ) {
|
||||||
Assert.failDbg(); // Is this happening? selfAddr is sometimes
|
final CommsAddrRec hostAddr = null;
|
||||||
// hostAddr so it can't work.
|
try ( GamePtr gamePtr = XwJNI.initNew( gi, selfAddr, hostAddr,
|
||||||
try ( GamePtr gamePtr = XwJNI.initNew( gi, selfAddr, (CommsAddrRec)null,
|
|
||||||
util, (DrawCtx)null, cp, sink ) ) {
|
util, (DrawCtx)null, cp, sink ) ) {
|
||||||
if ( null != gamePtr ) {
|
if ( null != gamePtr ) {
|
||||||
applyChangesImpl( context, sink, gi, disab, lock, gamePtr );
|
applyChangesImpl( context, sink, gi, disab, lock, gamePtr );
|
||||||
|
|
Loading…
Add table
Reference in a new issue