mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +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
b03f767e6c
commit
52f839e899
1 changed files with 7 additions and 3 deletions
|
@ -304,15 +304,19 @@ and_util_engineProgressCallback( XW_UtilCtxt* uc )
|
|||
bool
|
||||
utilTimerFired( XW_UtilCtxt* uc, XWTimerReason why, int handle )
|
||||
{
|
||||
bool handled;
|
||||
bool handled = false;
|
||||
AndUtil* util = (AndUtil*)uc;
|
||||
TimerStorage* timerStorage = &util->timerStorage[why];
|
||||
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 {
|
||||
XP_LOGF( "%s: mismatch: handle=%d; timerStorage=%d", __func__,
|
||||
handle, (int)timerStorage );
|
||||
handled = false;
|
||||
}
|
||||
return handled;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue