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();