X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/cea8c5cd75b88cd5a13d9b253d792cc045d28b62..7229d60d0356e94f553623e0492f636687ac39e6:/src/sort.c

diff --git a/src/sort.c b/src/sort.c
index 1cf8932e..ff275c95 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -199,6 +199,9 @@ void sortCommand(redisClient *c) {
         j++;
     }
 
+    /* Destructively convert encoded sorted sets for SORT. */
+    if (sortval->type == REDIS_ZSET) zsetConvert(sortval, REDIS_ENCODING_SKIPLIST);
+
     /* Load the sorting vector with all the objects to sort */
     switch(sortval->type) {
     case REDIS_LIST: vectorlen = listTypeLength(sortval); break;