Skip to content

Commit 75937b5

Browse files
authored
Fix NullReferenceException in Orphan() codepath (#3908 from Azure/cgillum-patch-1)
2 parents 47e51df + 4cf20e4 commit 75937b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/WebJobs.Script.WebHost/WebJobsScriptHostService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ private bool ShutdownHostIfUnhealthy()
368368
/// <param name="instance">The <see cref="IHost"/> instance to remove</param>
369369
private async Task Orphan(IHost instance, ILogger logger, CancellationToken cancellationToken = default)
370370
{
371-
var scriptHost = (ScriptHost)instance.Services.GetService<ScriptHost>();
371+
var scriptHost = (ScriptHost)instance?.Services.GetService<ScriptHost>();
372372
if (scriptHost != null)
373373
{
374374
scriptHost.HostInitializing -= OnHostInitializing;

0 commit comments

Comments
 (0)