From fe6e44fd9e690ee4ed637dff6da1abd2aa340586 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Vavru=C5=A1a?= <marek.vavrusa@nic.cz>
Date: Tue, 9 Jun 2015 20:31:36 +0200
Subject: [PATCH] lib/zonecut: check for parent of root

---
 lib/zonecut.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/zonecut.c b/lib/zonecut.c
index 3cfef5048..143336fef 100644
--- a/lib/zonecut.c
+++ b/lib/zonecut.c
@@ -254,12 +254,12 @@ int kr_zonecut_find_cached(struct kr_context *ctx, struct kr_zonecut *cut, const
 
 	/* Start at QNAME parent. */
 	name = knot_wire_next_label(name, NULL);
-	while (txn) {
+	while (txn && name) {
 		if (fetch_ns(ctx, cut, name, txn, timestamp) == 0) {
 			update_cut_name(cut, name);
 			return kr_ok();
 		}
-		if (name[0] == '\0') {
+		if (!name || !name[0]) {
 			break;
 		}
 		/* Subtract label from QNAME. */
-- 
GitLab