Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/messages_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdbool.h>

#include <libyang/libyang.h>

Expand Down Expand Up @@ -828,6 +829,7 @@ nc_server_notif_new(struct lyd_node* event, char *eventtime, NC_PARAMTYPE paramt
{
struct nc_server_notif *ntf;
struct lyd_node *elem;
bool found_notif = false;

if (!event) {
ERRARG("event");
Expand All @@ -838,7 +840,7 @@ nc_server_notif_new(struct lyd_node* event, char *eventtime, NC_PARAMTYPE paramt
}

/* check that there is a notification */
for (elem = event; elem && (elem->schema->nodetype != LYS_NOTIF); elem = elem->child) {
for (elem = event; elem && !found_notif; elem = elem->child) {
next_node:
switch (elem->schema->nodetype) {
case LYS_LEAF:
Expand All @@ -852,16 +854,18 @@ nc_server_notif_new(struct lyd_node* event, char *eventtime, NC_PARAMTYPE paramt
goto next_node;
case LYS_CONTAINER:
case LYS_LIST:
case LYS_NOTIF:
/* ok */
break;
case LYS_NOTIF:
found_notif = true;
break;
default:
/* error */
ERRARG("event");
return NULL;
}
}
if (!elem) {
if (!found_notif) {
ERRARG("event");
return NULL;
}
Expand Down