schema compile BUGFIX compiling bases for identities

... whose definitions are both from the main module
and its submodules.
Refs sysrepo/sysrepo#2472
diff --git a/src/schema_compile.c b/src/schema_compile.c
index c030634..a907b2c 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -467,11 +467,12 @@
             }
             ++v;
         }
-        assert(v < LY_ARRAY_COUNT(idents_p));
 
-        if (!idents_p[v].bases) {
+        if ((v == LY_ARRAY_COUNT(idents_p)) || !idents_p[v].bases) {
+            /* identity not found (it may be from a submodule) or identity without bases */
             continue;
         }
+
         lysc_update_path(ctx, NULL, (*idents)[u].name);
         LY_CHECK_RET(lys_compile_identity_bases(ctx, (*idents)[u].module->parsed, idents_p[v].bases, &(*idents)[u], NULL,
                 &enabled));