Skip to content

Commit ce2302c

Browse files
authored
Fix the null-reference exception when running Debug-Job on a thread job (#3957)
1 parent d332e21 commit ce2302c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

PSReadLine/Prediction.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ private static void UpdatePredictionClient(Runspace runspace, EngineIntrinsics e
5050
if (s_pCurrentLocation is not null)
5151
{
5252
// Set the current location if it's a local Runspace. Otherwise, set it to null.
53-
object path = runspace.RunspaceIsRemote ? null : engineIntrinsics.SessionState.Path.CurrentLocation;
53+
object path = runspace is null || runspace.RunspaceIsRemote
54+
? null
55+
: engineIntrinsics?.SessionState.Path.CurrentLocation;
5456
s_pCurrentLocation.SetValue(s_predictionClient, path);
5557
}
5658
}

0 commit comments

Comments
 (0)