mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-31 19:57:06 +01:00
fix crash: check that tile exists before removing
This commit is contained in:
parent
0f18efb925
commit
93a621c65c
1 changed files with 21 additions and 20 deletions
|
@ -1027,29 +1027,30 @@ model_moveBoardToTray( ModelCtxt* model, XP_S16 turn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* may be legal to fail to find, but we'd better return now! */
|
/* if we're called from putBackOtherPlayersTiles there may be nothing
|
||||||
XP_ASSERT( index < player->nPending );
|
here */
|
||||||
|
if ( index < player->nPending ) {
|
||||||
|
decrPendingTileCountAt( model, col, row );
|
||||||
|
notifyBoardListeners( model, turn, col, row, XP_FALSE );
|
||||||
|
|
||||||
decrPendingTileCountAt( model, col, row );
|
tile = pt->tile;
|
||||||
notifyBoardListeners( model, turn, col, row, XP_FALSE );
|
if ( (tile & TILE_BLANK_BIT) != 0 ) {
|
||||||
|
tile = dict_getBlankTile( model->vol.dict );
|
||||||
|
}
|
||||||
|
|
||||||
tile = pt->tile;
|
model_addPlayerTile( model, turn, trayOffset, tile );
|
||||||
if ( (tile & TILE_BLANK_BIT) != 0 ) {
|
|
||||||
tile = dict_getBlankTile( model->vol.dict );
|
--player->nPending;
|
||||||
|
for ( i = index; i < player->nPending; ++i ) {
|
||||||
|
player->pendingTiles[i] = player->pendingTiles[i+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( player->nPending == 0 ) {
|
||||||
|
invalLastMove( model );
|
||||||
|
}
|
||||||
|
|
||||||
|
invalidateScore( model, turn );
|
||||||
}
|
}
|
||||||
|
|
||||||
model_addPlayerTile( model, turn, trayOffset, tile );
|
|
||||||
|
|
||||||
--player->nPending;
|
|
||||||
for ( i = index; i < player->nPending; ++i ) {
|
|
||||||
player->pendingTiles[i] = player->pendingTiles[i+1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( player->nPending == 0 ) {
|
|
||||||
invalLastMove( model );
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidateScore( model, turn );
|
|
||||||
} /* model_moveBoardToTray */
|
} /* model_moveBoardToTray */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Reference in a new issue