schema compile BUGFIX prevent when unres without a node
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 560756a..c7724ec 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -548,8 +548,10 @@
         *new_when = *when_c;
     }
 
-    /* add when to unres */
-    LY_CHECK_GOTO(rc = lysc_unres_when_add(ctx, *new_when, node), cleanup);
+    if (node) {
+        /* add when to unres if there is a node for evaluation (not for extension instances) */
+        LY_CHECK_GOTO(rc = lysc_unres_when_add(ctx, *new_when, node), cleanup);
+    }
 
 cleanup:
     return rc;