API: nvim_unsubscribe(): Handle unknown events #8745

close #8745
This commit is contained in:
Daniel Hahler
2018-07-14 18:23:08 +02:00
committed by Justin M. Keyes
parent 10e885bdfc
commit 643ef257b3
2 changed files with 12 additions and 0 deletions

View File

@@ -505,6 +505,11 @@ end:
static void unsubscribe(Channel *channel, char *event)
{
char *event_string = pmap_get(cstr_t)(event_strings, event);
if (!event_string) {
WLOG("RPC: ch %" PRIu64 ": tried to unsubscribe unknown event '%s'",
channel->id, event);
return;
}
pmap_del(cstr_t)(channel->rpc.subscribed_events, event_string);
map_foreach_value(channels, channel, {