BUGFIX dereferencing NULL pointer
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 0c8ef83..fda309b 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -216,7 +216,7 @@
             /* schema subtree */
             snode = lys_child(parent, LYS_UNKNOWN);
             /* do not return anything if the augment does not have any children */
-            if (!snode || ((parent->nodetype == LYS_AUGMENT) && ((*snode)->parent != parent))) {
+            if (!snode || !(*snode) || ((parent->nodetype == LYS_AUGMENT) && ((*snode)->parent != parent))) {
                 return NULL;
             }
             next = last = *snode;