From 9fc2ca9763f83e2b26152a2329541e92fee6c102 Mon Sep 17 00:00:00 2001 From: Ian Hu Date: Sat, 11 Mar 2017 15:44:29 +0800 Subject: [PATCH] fix core dump --- src/tcp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tcp.c b/src/tcp.c index ef9ee6f..fdcb8d7 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -127,7 +127,14 @@ int tcp_open(lua_State *L) \*-------------------------------------------------------------------------*/ static int meth_send(lua_State *L) { p_tcp tcp = (p_tcp) auxiliar_checkclass(L, "tcp{client}", 1); - return buffer_meth_send(L, &tcp->buf); + p_buffer buf = &tcp->buf; + if (buf->tm == NULL) { + buf->tm = &tcp->tm; + } + if (buf->io == NULL) { + buf->io = &tcp->io; + } + return buffer_meth_send(L, buf); } static int meth_receive(lua_State *L) {