mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
fix null procptr crash in jni
I can't reproduce this, but while testing recovery from DatagramSocket recreation in RelayService got enough to know that somehow a timer's procptr's not set. So test before calling, and log instead of crashing.
This commit is contained in:
parent
36cc181a5e
commit
d25041e8a0
1 changed files with 7 additions and 3 deletions
|
@ -304,15 +304,19 @@ and_util_engineProgressCallback( XW_UtilCtxt* uc )
|
||||||
bool
|
bool
|
||||||
utilTimerFired( XW_UtilCtxt* uc, XWTimerReason why, int handle )
|
utilTimerFired( XW_UtilCtxt* uc, XWTimerReason why, int handle )
|
||||||
{
|
{
|
||||||
bool handled;
|
bool handled = false;
|
||||||
AndUtil* util = (AndUtil*)uc;
|
AndUtil* util = (AndUtil*)uc;
|
||||||
TimerStorage* timerStorage = &util->timerStorage[why];
|
TimerStorage* timerStorage = &util->timerStorage[why];
|
||||||
if ( handle == (int)timerStorage ) {
|
if ( handle == (int)timerStorage ) {
|
||||||
handled = (*timerStorage->proc)( timerStorage->closure, why );
|
XWTimerProc proc = timerStorage->proc;
|
||||||
|
if ( !!proc ) {
|
||||||
|
handled = (*proc)( timerStorage->closure, why );
|
||||||
|
} else {
|
||||||
|
XP_LOGF( "%s(why=%d): ERROR: no proc set", __func__, why );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
XP_LOGF( "%s: mismatch: handle=%d; timerStorage=%d", __func__,
|
XP_LOGF( "%s: mismatch: handle=%d; timerStorage=%d", __func__,
|
||||||
handle, (int)timerStorage );
|
handle, (int)timerStorage );
|
||||||
handled = false;
|
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue