From dfb180cb50357c19a5b520f3c87587beadf94a4f Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Fri, 16 Feb 2018 22:36:47 +0530 Subject: [PATCH] Zone: fixed bug causing record to get deleted while modify process due to zone object getting removed. Fixed null pointer exception bug. --- DnsServerCore/Zone.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/DnsServerCore/Zone.cs b/DnsServerCore/Zone.cs index 3a8ea888..8be466f8 100644 --- a/DnsServerCore/Zone.cs +++ b/DnsServerCore/Zone.cs @@ -1,6 +1,6 @@ /* Technitium DNS Server -Copyright (C) 2017 Shreyas Zare (shreyas@technitium.com) +Copyright (C) 2018 Shreyas Zare (shreyas@technitium.com) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -834,12 +834,7 @@ namespace DnsServerCore default: currentZone.DeleteRecord(oldRecord); - - if (oldRecord.Name.Equals(newRecord.Name, StringComparison.CurrentCultureIgnoreCase)) - currentZone.AddRecord(newRecord); - else - CreateZone(this, newRecord.Name).AddRecord(newRecord); - + CreateZone(this, newRecord.Name).AddRecord(newRecord); //create zone since delete record will also delete empty sub zones break; } } @@ -862,7 +857,7 @@ namespace DnsServerCore { Zone currentZone = GetZone(this, domain, authoritative); if (currentZone == null) - return null; + return new DnsResourceRecord[] { }; DnsResourceRecord[] records = currentZone.GetAllRecords(includeSubDomains); if (records != null)