From 3703a170e77ef6daec0da8ba1c56c8a608d74d93 Mon Sep 17 00:00:00 2001 From: Kukks Date: Thu, 13 Jul 2023 14:59:18 +0200 Subject: [PATCH] try fix migration for pos yml --- BTCPayServer/Hosting/MigrationStartupTask.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/Hosting/MigrationStartupTask.cs b/BTCPayServer/Hosting/MigrationStartupTask.cs index 42936611c..8a7f38146 100644 --- a/BTCPayServer/Hosting/MigrationStartupTask.cs +++ b/BTCPayServer/Hosting/MigrationStartupTask.cs @@ -341,9 +341,13 @@ namespace BTCPayServer.Hosting { var items = new List(); var stream = new YamlStream(); + if (string.IsNullOrEmpty(yaml)) + return items.ToArray(); + stream.Load(new StringReader(yaml)); - var root = stream.Documents.First().RootNode as YamlMappingNode; + if(stream.Documents.FirstOrDefault()?.RootNode is not YamlMappingNode root) + return items.ToArray(); foreach (var posItem in root.Children) { var trimmedKey = ((YamlScalarNode)posItem.Key).Value?.Trim();