From 8f482c534f15c14a9b3097313a4f5e9273549d88 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 7 May 2023 20:23:47 +0300 Subject: [PATCH] Fixed: custom script error when importing some downloads Co-authored-by: Qstick <376117+Qstick@users.noreply.github.com> Closes #5617 --- src/NzbDrone.Common/Processes/ProcessProvider.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Common/Processes/ProcessProvider.cs b/src/NzbDrone.Common/Processes/ProcessProvider.cs index e3c3df957..be443e195 100644 --- a/src/NzbDrone.Common/Processes/ProcessProvider.cs +++ b/src/NzbDrone.Common/Processes/ProcessProvider.cs @@ -127,7 +127,11 @@ namespace NzbDrone.Common.Processes try { _logger.Trace("Setting environment variable '{0}' to '{1}'", environmentVariable.Key, environmentVariable.Value); - startInfo.EnvironmentVariables.Add(environmentVariable.Key.ToString(), environmentVariable.Value.ToString()); + + var key = environmentVariable.Key.ToString(); + var value = environmentVariable.Value?.ToString(); + + startInfo.EnvironmentVariables[key] = value; } catch (Exception e) {