From 37646c20f3ed668376c65315db04f1d1683afc65 Mon Sep 17 00:00:00 2001 From: eehouse Date: Tue, 9 Feb 2010 14:42:07 +0000 Subject: [PATCH] accomodate null objects --- xwords4/common/board.c | 8 ++++---- xwords4/common/game.c | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/xwords4/common/board.c b/xwords4/common/board.c index c272801ab..521cd96cb 100644 --- a/xwords4/common/board.c +++ b/xwords4/common/board.c @@ -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 ); + } } } diff --git a/xwords4/common/game.c b/xwords4/common/game.c index 21ea739c9..d5d74f1f0 100644 --- a/xwords4/common/game.c +++ b/xwords4/common/game.c @@ -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 );