From 4402b81bdfbd687388d4c6a229c7e41eae397fe7 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 4 Mar 2016 19:29:42 -0800 Subject: [PATCH] fix crash (assertion failure) finding words associated with a cell when there's a trade above it on the move stack. --- xwords4/common/model.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/xwords4/common/model.c b/xwords4/common/model.c index e134e8c11..94c04eb9a 100644 --- a/xwords4/common/model.c +++ b/xwords4/common/model.c @@ -829,7 +829,7 @@ replaceNewTiles( ModelCtxt* model, PoolContext* pool, XP_U16 turn, model_removePlayerTile( model, turn, index ); } if ( !!pool ) { - pool_replaceTiles( pool, tileSet); + pool_replaceTiles( pool, tileSet ); } } /* replaceNewTiles */ @@ -905,17 +905,12 @@ model_undoLatestMoves( ModelCtxt* model, PoolContext* pool, undoFromMoveInfo( model, turn, blankTile, &entry.u.move.moveInfo ); } else if ( entry.moveType == TRADE_TYPE ) { - + replaceNewTiles( model, pool, turn, + &entry.u.trade.newTiles ); if ( pool != NULL ) { - /* If there's no pool, assume we're doing this for - scoring purposes only. */ - replaceNewTiles( model, pool, turn, - &entry.u.trade.newTiles ); - pool_removeTiles( pool, &entry.u.trade.oldTiles ); - assignPlayerTiles( model, turn, &entry.u.trade.oldTiles ); } - + assignPlayerTiles( model, turn, &entry.u.trade.oldTiles ); } else if ( entry.moveType == PHONY_TYPE ) { /* nothing to do, since nothing happened */ } else {