From b12d12590a7e91693331e329472e40673648db2b Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 9 Oct 2014 21:21:41 -0700 Subject: [PATCH] don't memcpy 0 bytes --- xwords4/common/strutils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;