From ae200b374b9ac2d44fbcb17317ccafa595ff8ad5 Mon Sep 17 00:00:00 2001 From: Jake Norbut Date: Fri, 4 Jan 2019 12:38:56 -0600 Subject: [PATCH] PR suggestion --- src/client/spark/Images/Icons.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/client/spark/Images/Icons.cs b/src/client/spark/Images/Icons.cs index 54c88a41b..7dc2068aa 100644 --- a/src/client/spark/Images/Icons.cs +++ b/src/client/spark/Images/Icons.cs @@ -154,18 +154,19 @@ namespace mbts.ui { } static IEnumerable _get_geometric_path(string geometric_path_key) { + object obj; lock (_resources) { - object obj = _resources[geometric_path_key]; - if (obj is string path) { - if (string.IsNullOrEmpty(path)) { - Log.Api.error($"Resource lookup of '{geometric_path_key}' did not return a valid string.", nameof(geometric_path_key)); - path = string.Empty; - } - return new[] { path }; - } else if (obj is string[] paths) { - return paths.Where(p => !string.IsNullOrEmpty(p)).ToArray(); - } else return null; + obj = _resources[geometric_path_key]; } + if (obj is string path) { + if (string.IsNullOrEmpty(path)) { + Log.Api.error($"Resource lookup of '{geometric_path_key}' did not return a valid string.", nameof(geometric_path_key)); + path = string.Empty; + } + return new[] { path }; + } else if (obj is string[] paths) { + return paths.Where(p => !string.IsNullOrEmpty(p)).ToArray(); + } else return null; } } } \ No newline at end of file