summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2017-11-17 13:47:50 +0100
committerantirez <antirez@gmail.com>2017-11-17 13:47:50 +0100
commit9e0f6a4994c397abe4443d728d59a95b1125c9dd (patch)
tree1254e25c4279afd9d9406043916ed9b61e2445c1
parent5f1e053fc8b1997ebfe3182f2640f9ea88c70876 (diff)
downloadredis-9e0f6a4994c397abe4443d728d59a95b1125c9dd.tar.gz
Streams: fix reverse iteration next node jumping.
-rw-r--r--src/t_stream.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/t_stream.c b/src/t_stream.c
index 945fc28c0..f64824c9b 100644
--- a/src/t_stream.c
+++ b/src/t_stream.c
@@ -540,7 +540,11 @@ int streamIteratorGetID(streamIterator *si, streamID *id, int64_t *numfields) {
* entry is composed of, and jump backward N times to seek
* its start. */
int lp_count = lpGetInteger(si->lp_ele);
- if (lp_count == 0) break; /* We reached the master entry. */
+ if (lp_count == 0) { /* We reached the master entry. */
+ si->lp = NULL;
+ si->lp_ele = NULL;
+ break;
+ }
while(lp_count--) si->lp_ele = lpPrev(si->lp,si->lp_ele);
}