extensions BUGFIX dereferencing NULL pointer

accessing data storage places in extension instances when a statement
to store was not used in the extension instance.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index f0ac196..0fc1783 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -4455,7 +4455,7 @@
                 case LY_STMT_MIN:
                 case LY_STMT_POSITION:
                     pp = (void**)&((struct lys_ext_instance_complex *)e[i])->content[substmt[j].offset];
-                    if (substmt[j].cardinality >= LY_STMT_CARD_SOME) {
+                    if (substmt[j].cardinality >= LY_STMT_CARD_SOME && *pp) {
                         for(k = 0; ((uint32_t**)(*pp))[k]; k++) {
                             free(((uint32_t**)(*pp))[k]);
                         }