Skip to content

Commit

Permalink
Fix crash if connection is lost (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
goebish authored Jan 2, 2021
1 parent e5b5947 commit ae0a26e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ RedisObject_t RedisConnection_getNextObject(RedisConnection_t conn)
readBytes = read(conn, &typeChar, sizeof(typeChar));
} while (readBytes == sizeof(typeChar) && (typeChar == -1 || typeChar == '\r' || typeChar == '\n'));

assert(readBytes == sizeof(typeChar));
// lost connection to server
if(readBytes != sizeof(typeChar))
return rObj;

RedisObjectTypeMap_t *typeMapWalk = RedisConnection_getNextObject__parseMap;
for (; typeMapWalk->type != RedisObjectType_InternalError && typeMapWalk->create != NULL; typeMapWalk++)
Expand Down

0 comments on commit ae0a26e

Please sign in to comment.