It used the wrong check to assess whether the w_buffer is usable.
The chain stream only uses the w_buffer when partial stream data needs to be merged. Otherwise, a parent stream's buffer is used directly. However, this does not mean that w_buffer will be NULL in that case, which is what i_stream_next_line() assumed.
stream->line_crlf = FALSE;
}
- if (stream->w_buffer != NULL) {
+ if (stream->buffer == stream->w_buffer) {
/* modify the buffer directly */
stream->w_buffer[end] = '\0';
ret = (char *)stream->w_buffer + stream->skip;