Merge pull request #2074 from hugeping/printer_tree-segfault

printer_tree: avoid NULL pointer dereference in trp_ext_is_present()
diff --git a/src/printer_tree.c b/src/printer_tree.c
index 0b861c5..6aa2814 100644
--- a/src/printer_tree.c
+++ b/src/printer_tree.c
@@ -1873,7 +1873,7 @@
     } else {
         pn = (const struct lysp_node *)node;
         LY_ARRAY_FOR(pn->exts, i) {
-            if (!(pn->exts && pn->exts->record->plugin.printer_ptree)) {
+            if (!(pn->exts && pn->exts->record && pn->exts->record->plugin.printer_ptree)) {
                 continue;
             }
             if (!trp_ext_parent_is_valid(0, &pn->exts[i])) {