tree data BUGFIX inserting data for several ext instances

Fixes #2070
diff --git a/src/tree_data.c b/src/tree_data.c
index c7fb06e..a5a64de 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -489,6 +489,10 @@
 
         /* get the first schema sibling */
         schema = lys_getnext(NULL, sparent, new_node->schema->module->compiled, getnext_opts);
+        if (!schema) {
+            /* must be a top-level extension instance data, insert at the end */
+            return first_sibling->prev;
+        }
 
         found = 0;
         LY_LIST_FOR(match, match) {
@@ -511,8 +515,12 @@
                     /* current node (match) is a data node still before the new node, continue search in data */
                     break;
                 }
+
                 schema = lys_getnext(schema, sparent, new_node->schema->module->compiled, getnext_opts);
-                assert(schema);
+                if (!schema) {
+                    /* must be a top-level extension instance data, insert at the end */
+                    return first_sibling->prev;
+                }
             }
 
             if (found && (match->schema != new_node->schema)) {