accomodate null objects

This commit is contained in:
eehouse 2010-02-09 14:42:07 +00:00
parent 2d17649af5
commit 37646c20f3
2 changed files with 10 additions and 7 deletions

View file

@ -133,7 +133,6 @@ board_make( MPFORMAL ModelCtxt* model, ServerCtxt* server, DrawCtx* draw,
XW_UtilCtxt* util )
{
BoardCtxt* result = (BoardCtxt*)XP_MALLOC( mpool, sizeof( *result ) );
XP_ASSERT( !!draw );
XP_ASSERT( !!server );
XP_ASSERT( !!util );
XP_ASSERT( !!model );
@ -2995,9 +2994,10 @@ dictChanged( void* p_board, const DictionaryCtxt* oldDict,
const DictionaryCtxt* newDict )
{
BoardCtxt* board = (BoardCtxt*)p_board;
XP_ASSERT( !!board->draw );
if ( (NULL == oldDict) || (oldDict != newDict) ) {
draw_dictChanged( board->draw, newDict );
if ( !!board->draw ) {
if ( (NULL == oldDict) || (oldDict != newDict) ) {
draw_dictChanged( board->draw, newDict );
}
}
}

View file

@ -30,8 +30,11 @@ extern "C" {
static void
assertUtilOK( XW_UtilCtxt* util )
{
UtilVtable* vtable = util->vtable;
XP_U16 nSlots = sizeof(vtable) / 4;
UtilVtable* vtable;
XP_U16 nSlots;
XP_ASSERT( !!util );
vtable = util->vtable;
nSlots = sizeof(vtable) / 4;
while ( nSlots-- ) {
void* fptr = ((void**)vtable)[nSlots];
XP_ASSERT( !!fptr );
@ -90,7 +93,7 @@ game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi,
gi->boardSize, gi->boardSize );
#ifndef XWFEATURE_STANDALONE_ONLY
if ( !!procs && gi->serverRole != SERVER_STANDALONE ) {
if ( gi->serverRole != SERVER_STANDALONE ) {
game->comms = comms_make( MPPARM(mpool) util,
gi->serverRole != SERVER_ISCLIENT,
nPlayersHere, nPlayersTotal, procs );