schema compile BUGFIX avoid traversing an invalid node
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 74448d7..b1f76e7 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -2029,8 +2029,14 @@
     }
 
     getnext_flags = LYS_GETNEXT_WITHCHOICE;
-    if (parent && (parent->nodetype & (LYS_RPC | LYS_ACTION)) && (exclude->flags & LYS_IS_OUTPUT)) {
-        getnext_flags |= LYS_GETNEXT_OUTPUT;
+    if (parent && (parent->nodetype & (LYS_RPC | LYS_ACTION))) {
+        /* move to the inout to avoid traversing a not-filled-yet (the other) node */
+        if (exclude->flags & LYS_IS_OUTPUT) {
+            getnext_flags |= LYS_GETNEXT_OUTPUT;
+            parent = lysc_node_child(parent)->next;
+        } else {
+            parent = lysc_node_child(parent);
+        }
     }
 
     iter = NULL;