summaryrefslogtreecommitdiff
path: root/src/t_stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/t_stream.c')
-rw-r--r--src/t_stream.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/t_stream.c b/src/t_stream.c
index fc5c4c99e..1ab85a3b1 100644
--- a/src/t_stream.c
+++ b/src/t_stream.c
@@ -1108,14 +1108,10 @@ size_t streamReplyWithRangeFromConsumerPEL(client *c, stream *s, streamID *start
* The function creates a key setting it to an empty stream if needed. */
robj *streamTypeLookupWriteOrCreate(client *c, robj *key) {
robj *o = lookupKeyWrite(c->db,key);
+ if (checkType(c,o,OBJ_STREAM)) return NULL;
if (o == NULL) {
o = createStreamObject();
dbAdd(c->db,key,o);
- } else {
- if (o->type != OBJ_STREAM) {
- addReply(c,shared.wrongtypeerr);
- return NULL;
- }
}
return o;
}
@@ -1460,7 +1456,7 @@ void xreadCommand(client *c) {
int id_idx = i - streams_arg - streams_count;
robj *key = c->argv[i-streams_count];
robj *o = lookupKeyRead(c->db,key);
- if (o && checkType(c,o,OBJ_STREAM)) goto cleanup;
+ if (checkType(c,o,OBJ_STREAM)) goto cleanup;
streamCG *group = NULL;
/* If a group was specified, than we need to be sure that the
@@ -2022,7 +2018,7 @@ void xpendingCommand(client *c) {
robj *o = lookupKeyRead(c->db,c->argv[1]);
streamCG *group;
- if (o && checkType(c,o,OBJ_STREAM)) return;
+ if (checkType(c,o,OBJ_STREAM)) return;
if (o == NULL ||
(group = streamLookupCG(o->ptr,groupname->ptr)) == NULL)
{