Skip to content

Commit 2180ad6

Browse files
committed
exmdb_client: guard against unset build_env hook
Addendum to d099a2d .
1 parent b1ce64a commit 2180ad6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/exmdb_client.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,15 @@ static int cl_notif_reader3(agent_thread &agent, pollfd &pfd,
292292
BINARY bin;
293293
bin.cb = buff_len;
294294
bin.pb = buff;
295-
mdcl_build_env(*agent.pserver);
295+
if (mdcl_build_env != nullptr)
296+
mdcl_build_env(*agent.pserver);
296297
auto cl_0 = HX::make_scope_exit([]() { if (mdcl_free_env != nullptr) mdcl_free_env(); });
297298
DB_NOTIFY_DATAGRAM notify;
298299
auto resp_code = exmdb_ext_pull_db_notify(&bin, &notify) == pack_result::ok ?
299300
exmdb_response::success : exmdb_response::pull_error;
300301
if (write(agent.sockd, &resp_code, 1) != 1)
301302
return -1;
302-
if (resp_code == exmdb_response::success)
303+
if (resp_code == exmdb_response::success && mdcl_event_proc != nullptr)
303304
for (size_t i = 0; i < notify.id_array.size(); ++i)
304305
mdcl_event_proc(notify.dir, notify.b_table,
305306
notify.id_array[i], &notify.db_notify);

0 commit comments

Comments
 (0)