BUGFIX possible NULL pointer dereferences
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 98c27d2..08b5189 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -268,6 +268,9 @@
         /* in case of realloc */
         *word_p = *word_b;
     } else if (need_buf) {
+        /* check  valid combination of input paremeters - if need_buf specified, word_b must be provided */
+        assert(word_b);
+
         /* first time we need a buffer, copy everything read up to now */
         if (*word_len) {
             *word_b = malloc(*word_len);
diff --git a/src/tree_schema.c b/src/tree_schema.c
index cabccb2..07a661d 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -165,7 +165,7 @@
         goto repeat;
     default:
         /* we should not be here */
-        LOGINT(last->module->ctx);
+        LOGINT(module ? module->mod->ctx : parent->module->ctx);
         return NULL;
     }
 
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index 57c381b..7132f56 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -631,7 +631,7 @@
         /* check revision of the parsed model */
         if (!revs || strcmp(info->revision, revs[0].date)) {
             LOGERR(ctx, LY_EINVAL, "Module \"%s\" parsed with the wrong revision (\"%s\" instead \"%s\").", name,
-                   revs[0].date, info->revision);
+                   revs ? revs[0].date : "none", info->revision);
             return LY_EINVAL;
         }
     }