mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
don't crash on null dctxt
This commit is contained in:
parent
88af10552e
commit
3858893ab2
2 changed files with 24 additions and 17 deletions
|
@ -644,6 +644,7 @@ makeDraw( MPFORMAL JNIEnv** envp, jobject jdraw )
|
||||||
void
|
void
|
||||||
destroyDraw( DrawCtx** dctx )
|
destroyDraw( DrawCtx** dctx )
|
||||||
{
|
{
|
||||||
|
if ( !!*dctx ) {
|
||||||
AndDraw* draw = (AndDraw*)*dctx;
|
AndDraw* draw = (AndDraw*)*dctx;
|
||||||
JNIEnv* env = *draw->env;
|
JNIEnv* env = *draw->env;
|
||||||
if ( NULL != draw->jdraw ) {
|
if ( NULL != draw->jdraw ) {
|
||||||
|
@ -661,4 +662,5 @@ destroyDraw( DrawCtx** dctx )
|
||||||
XP_FREE( draw->mpool, draw->vtable );
|
XP_FREE( draw->mpool, draw->vtable );
|
||||||
XP_FREE( draw->mpool, draw );
|
XP_FREE( draw->mpool, draw );
|
||||||
*dctx = NULL;
|
*dctx = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,7 +417,10 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeNewGame
|
||||||
globals->util = makeUtil( MPPARM(mpool) &state->env, j_util, gi,
|
globals->util = makeUtil( MPPARM(mpool) &state->env, j_util, gi,
|
||||||
globals );
|
globals );
|
||||||
globals->jniutil = makeJNIUtil( MPPARM(mpool) &state->env, jniu );
|
globals->jniutil = makeJNIUtil( MPPARM(mpool) &state->env, jniu );
|
||||||
DrawCtx* dctx = makeDraw( MPPARM(mpool) &state->env, j_draw );
|
DrawCtx* dctx = NULL;
|
||||||
|
if ( !!j_draw ) {
|
||||||
|
dctx = makeDraw( MPPARM(mpool) &state->env, j_draw );
|
||||||
|
}
|
||||||
globals->dctx = dctx;
|
globals->dctx = dctx;
|
||||||
globals->xportProcs = makeXportProcs( MPPARM(mpool) &state->env, j_procs );
|
globals->xportProcs = makeXportProcs( MPPARM(mpool) &state->env, j_procs );
|
||||||
CommonPrefs cp;
|
CommonPrefs cp;
|
||||||
|
@ -486,7 +489,9 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeFromStream
|
||||||
globals->jniutil = makeJNIUtil( MPPARM(mpool) &state->env, jniu );
|
globals->jniutil = makeJNIUtil( MPPARM(mpool) &state->env, jniu );
|
||||||
makeDicts( MPPARM(mpool) env, globals->jniutil, &dict, &dicts, jdictNames,
|
makeDicts( MPPARM(mpool) env, globals->jniutil, &dict, &dicts, jdictNames,
|
||||||
jdicts, jpaths, jlang );
|
jdicts, jpaths, jlang );
|
||||||
|
if ( !!jdraw ) {
|
||||||
globals->dctx = makeDraw( MPPARM(mpool) &state->env, jdraw );
|
globals->dctx = makeDraw( MPPARM(mpool) &state->env, jdraw );
|
||||||
|
}
|
||||||
globals->xportProcs = makeXportProcs( MPPARM(mpool) &state->env, jprocs );
|
globals->xportProcs = makeXportProcs( MPPARM(mpool) &state->env, jprocs );
|
||||||
|
|
||||||
XWStreamCtxt* stream = streamFromJStream( MPPARM(mpool) env,
|
XWStreamCtxt* stream = streamFromJStream( MPPARM(mpool) env,
|
||||||
|
|
Loading…
Reference in a new issue