diff --git a/xwords4/common/strutils.c b/xwords4/common/strutils.c index 6ccd67673..c1485aefd 100644 --- a/xwords4/common/strutils.c +++ b/xwords4/common/strutils.c @@ -91,7 +91,9 @@ sortTiles( TrayTileSet* dest, const TrayTileSet* src, XP_U16 skip ) /* Copy in the ones we're not sorting */ dest->nTiles = skip; - XP_MEMCPY( &dest->tiles, &tmp.tiles, skip * sizeof(tmp.tiles[0]) ); + if ( 0 < skip ) { + XP_MEMCPY( &dest->tiles, &tmp.tiles, skip * sizeof(tmp.tiles[0]) ); + } while ( skip < tmp.nTiles ) { XP_U16 ii, smallest;