mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
bufferevent_pair: don't call downcast(NULL)
This commit is contained in:
parent
dfe1e526f5
commit
f2428a284b
@ -310,13 +310,14 @@ struct bufferevent *
|
||||
bufferevent_pair_get_partner(struct bufferevent *bev)
|
||||
{
|
||||
struct bufferevent_pair *bev_p;
|
||||
struct bufferevent *partner;
|
||||
struct bufferevent *partner = NULL;
|
||||
bev_p = upcast(bev);
|
||||
if (! bev_p)
|
||||
return NULL;
|
||||
|
||||
incref_and_lock(bev);
|
||||
partner = downcast(bev_p->partner);
|
||||
if (bev_p->partner)
|
||||
partner = downcast(bev_p->partner);
|
||||
decref_and_unlock(bev);
|
||||
return partner;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user