]> granicus.if.org Git - transmission/commitdiff
possible fix for softwareelves' error
authorCharles Kerr <charles@transmissionbt.com>
Wed, 23 Jul 2008 19:29:21 +0000 (19:29 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Wed, 23 Jul 2008 19:29:21 +0000 (19:29 +0000)
third-party/shttpd/shttpd.c

index cc55fa86f56825c39414604f12d2e0948d9a078a..13d99c89a3ab3ccc9e6a30e9680801914bdc3719 100644 (file)
@@ -898,7 +898,10 @@ read_stream(struct stream *stream)
                len = stream->content_len - stream->io.total;
 
        /* Read from underlying channel */
-       n = stream->io_class->read(stream, io_space(&stream->io), len);
+        if( stream->io_class )
+           n = stream->io_class->read(stream, io_space(&stream->io), len);
+        else
+            n = 0;
 
        if (n > 0)
                io_inc_head(&stream->io, n);
@@ -936,7 +939,11 @@ write_stream(struct stream *from, struct stream *to)
        assert(len > 0);
 
        /* TODO: should be assert on CAN_WRITE flag */
-       n = to->io_class->write(to, io_data(&from->io), len);
+        if( to->io_class )
+           n = to->io_class->write(to, io_data(&from->io), len);
+        else
+            n = 0;
+
        to->conn->expire_time = current_time + EXPIRE_TIME;
        DBG(("write_stream (%d %s): written %d/%d bytes (errno %d)",
            to->conn->rem.chan.sock,