Skip to content

Commit

Permalink
KevinJump#251 fix up parent check - not to fail when at root (e.g no …
Browse files Browse the repository at this point in the history
…parent is ok)
  • Loading branch information
KevinJump committed Jul 28, 2021
1 parent 79840db commit cda3cfa
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions uSync8.ContentEdition/Serializers/DictionaryItemSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,14 @@ protected bool HasParentItem(XElement node)
var info = node.Element("Info");

var parentItemKey = info.Element("Parent").ValueOrDefault(string.Empty);
if (parentItemKey != string.Empty)
if (!string.IsNullOrWhiteSpace(parentItemKey))
{
var parent = localizationService.GetDictionaryItemByKey(parentItemKey);
if (parent != null)
{
return true;
}
return parent != null;
}

return false;
// if the parent is empty, then there is no parent, and that is ok.
return true;
}

protected override SyncAttempt<IDictionaryItem> DeserializeCore(XElement node, SyncSerializerOptions options)
Expand Down

0 comments on commit cda3cfa

Please sign in to comment.