From cfe11cf038febc8262f91d43f370c824f55913b6 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 7 Feb 2016 17:18:03 +0000 Subject: ensure webidl intercalate copes with empty webidl --- src/webidl-ast.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/webidl-ast.c b/src/webidl-ast.c index 26851c3..0d908ce 100644 --- a/src/webidl-ast.c +++ b/src/webidl-ast.c @@ -672,16 +672,20 @@ intercalate_implements(struct webidl_node *interface_node, void *ctx) /* exported interface defined in webidl-ast.h */ int webidl_intercalate_implements(struct webidl_node *webidl_ast) { - /* for each interface: - * for each implements entry: - * find interface from implemets - * recusrse into that interface - * copy the interface into this one - */ - return webidl_node_for_each_type(webidl_ast, - WEBIDL_NODE_TYPE_INTERFACE, - intercalate_implements, - webidl_ast); + int res = 0; + if (webidl_ast != NULL) { + /* for each interface: + * for each implements entry: + * find interface from implemets + * recusrse into that interface + * copy the interface into this one + */ + res = webidl_node_for_each_type(webidl_ast, + WEBIDL_NODE_TYPE_INTERFACE, + intercalate_implements, + webidl_ast); + } + return res; } /* exported interface defined in webidl-ast.h */ -- cgit v1.2.3