fix crash: don't destroy stream if for some reason it's null. Not

sure how that happens, but it does.
This commit is contained in:
Andy2 2011-10-18 21:29:40 -07:00
parent 90b0a4e46f
commit c2a7a5c347

View file

@ -865,9 +865,12 @@ showPrevScore( ServerCtxt* server )
util_informMove( util, stream, server->nv.prevWordsStream );
stream_destroy( stream );
if ( !!server->nv.prevWordsStream ) {
stream_destroy( server->nv.prevWordsStream );
server->nv.prevWordsStream = NULL;
}
}
SETSTATE( server, server->nv.stateAfterShow );
} /* showPrevScore */
@ -875,16 +878,17 @@ XP_Bool
server_do( ServerCtxt* server )
{
XP_Bool result = XP_TRUE;
XP_Bool moreToDo = XP_FALSE;
if ( server->serverDoing ) {
return XP_FALSE;
}
result = XP_FALSE;
} else {
XP_Bool moreToDo = XP_FALSE;
server->serverDoing = XP_TRUE;
switch( server->nv.gameState ) {
case XWSTATE_BEGIN:
if ( server->nv.pendingRegistrations == 0 ) { /* all players on device */
if ( server->nv.pendingRegistrations == 0 ) { /* all players on
device */
assignTilesToAll( server );
SETSTATE( server, XWSTATE_INTURN );
setTurn( server, 0 );
@ -905,7 +909,8 @@ server_do( ServerCtxt* server )
#ifndef XWFEATURE_STANDALONE_ONLY
case XWSTATE_RECEIVED_ALL_REG:
server_sendInitialMessage( server );
/* PENDING isn't INTURN_OFFDEVICE possible too? Or just INTURN? */
/* PENDING isn't INTURN_OFFDEVICE possible too? Or just
INTURN? */
SETSTATE( server, XWSTATE_INTURN );
setTurn( server, 0 );
moreToDo = XP_TRUE;
@ -945,6 +950,7 @@ server_do( ServerCtxt* server )
}
server->serverDoing = XP_FALSE;
}
return result;
} /* server_do */