From 97214740c1d79f5c9325588a01bcebc880ac7268 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Thu, 28 Nov 2024 22:10:07 +0900 Subject: [PATCH] Avoid crash on useless config parameters (#470) --- NBXplorer/Configuration/ExplorerConfiguration.cs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/NBXplorer/Configuration/ExplorerConfiguration.cs b/NBXplorer/Configuration/ExplorerConfiguration.cs index 40338d28..f4a32aff 100644 --- a/NBXplorer/Configuration/ExplorerConfiguration.cs +++ b/NBXplorer/Configuration/ExplorerConfiguration.cs @@ -204,7 +204,7 @@ public ExplorerConfiguration LoadArgs(IConfiguration config) var obsolete = string.Join(", ", new[] { "dbtrie", "automigrate", "nomigrateevts", "nomigraterawtxs", "cachechain", "deleteaftermigration", "dbcache" } - .Where(o => TryGetOrDefault(config, o, false))); + .Where(o => !string.IsNullOrEmpty(config[o]))); if (obsolete != string.Empty) { @@ -216,18 +216,6 @@ public ExplorerConfiguration LoadArgs(IConfiguration config) return this; } - private T TryGetOrDefault(IConfiguration conf, string key, T defaultValue) - { - try - { - return conf.GetOrDefault(key, defaultValue); - } - catch - { - return defaultValue; - } - } - private int GetPort(EndPoint nodeEndpoint) { if (nodeEndpoint is IPEndPoint endPoint)