Skip to content

Commit

Permalink
Quick sanity check for (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
creationix committed May 14, 2016
1 parent 8beb6a0 commit 36a8008
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static uv_handle_t* luv_check_handle(lua_State* L, int index) {
int isHandle;
uv_handle_t* handle;
if (!(handle = *(void**)lua_touserdata(L, index))) { goto fail; }
if (!handle->data) { goto fail; }
lua_getfield(L, LUA_REGISTRYINDEX, "uv_handle");
lua_getmetatable(L, index < 0 ? index - 1 : index);
lua_rawget(L, -2);
Expand Down Expand Up @@ -102,7 +103,7 @@ static int luv_handle_gc(lua_State* L) {
if (handle != NULL) {
if (!uv_is_closing(handle))
uv_close(handle, luv_gc_cb);
else
else
free(*udata);

*udata = NULL;
Expand Down
1 change: 1 addition & 0 deletions src/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static uv_stream_t* luv_check_stream(lua_State* L, int index) {
int isStream;
uv_stream_t* handle;
if (!(handle = *(void**) lua_touserdata(L, index))) { goto fail; }
if (!handle->data) { goto fail; }
lua_getfield(L, LUA_REGISTRYINDEX, "uv_stream");
lua_getmetatable(L, index < 0 ? index - 1 : index);
lua_rawget(L, -2);
Expand Down

0 comments on commit 36a8008

Please sign in to comment.