mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
fix infinite loop when attempting to undo tile assignment. The ideal
fix would allow the undo, but this is much less risky.
This commit is contained in:
parent
a0be6e027a
commit
36bbf2d254
1 changed files with 9 additions and 1 deletions
|
@ -534,8 +534,13 @@ model_undoLatestMoves( ModelCtxt* model, PoolContext* pool,
|
|||
XP_Bool success = XP_TRUE;
|
||||
XP_S16 moveSought = *moveNumP;
|
||||
XP_U16 nMovesUndone;
|
||||
XP_U16 nStackEntries;
|
||||
|
||||
if ( stack_getNEntries( stack ) < nMovesSought ) {
|
||||
nStackEntries = stack_getNEntries( stack );
|
||||
if ( nStackEntries < nMovesSought ) {
|
||||
return XP_FALSE;
|
||||
} else if ( nStackEntries <= model->nPlayers ) {
|
||||
util_userError( model->vol.util, ERR_CANT_UNDO_TILEASSIGN );
|
||||
return XP_FALSE;
|
||||
}
|
||||
|
||||
|
@ -578,6 +583,7 @@ model_undoLatestMoves( ModelCtxt* model, PoolContext* pool,
|
|||
/* nothing to do, since nothing happened */
|
||||
|
||||
} else {
|
||||
XP_ASSERT( entry.moveType == ASSIGN_TYPE );
|
||||
success = XP_FALSE;
|
||||
break;
|
||||
}
|
||||
|
@ -616,6 +622,8 @@ model_undoLatestMoves( ModelCtxt* model, PoolContext* pool,
|
|||
notifyBoardListeners( model, entry.playerNum, col, row, XP_FALSE );
|
||||
}
|
||||
break;
|
||||
} else if ( entry.moveType == ASSIGN_TYPE ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue