diff options
author | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2012-03-11 17:40:16 +0400 |
---|---|---|
committer | Nicolas Favre-Felix <n.favrefelix@gmail.com> | 2012-03-11 17:40:16 +0400 |
commit | 4cf7677d05ea35bbea171411a0bc6a5aa2662883 (patch) | |
tree | 6069acb3923c03a55a6419128cf68a6a098c729d /library.c | |
parent | c18dcca60874f1bf68af6a839ae1a496db22657a (diff) |
Make sure stream exists when checking for EOF.
Addressing issue #143.
Diffstat (limited to 'library.c')
-rw-r--r-- | library.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -31,8 +31,13 @@ PHPAPI void redis_stream_close(RedisSock *redis_sock TSRMLS_DC) { PHPAPI int redis_check_eof(RedisSock *redis_sock TSRMLS_DC) { - int eof = php_stream_eof(redis_sock->stream); + int eof; int count = 0; + + if (!redis_sock->stream) + return -1; + + eof = php_stream_eof(redis_sock->stream); while(eof) { if((MULTI == redis_sock->mode) || redis_sock->watching || count++ == 10) { /* too many failures */ if(redis_sock->stream) { /* close stream if still here */ |