Skip to content

Commit 8766f32

Browse files
committed
Fix possible nullrefs
1 parent 0bf9a43 commit 8766f32

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

components/AppServices/src/AppServiceComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ private async void Connection_RequestReceived(AppServiceConnection sender, AppSe
462462
try
463463
{
464464
// Try to get the registered endpoint with the command name, and invoke it
465-
if (_endpoints.TryGetValue(commandStr, out Func<AppServiceParameters, Task<object?>> endpoint))
465+
if (_endpoints.TryGetValue(commandStr, out Func<AppServiceParameters, Task<object?>>? endpoint) && endpoint is {})
466466
{
467467
response = await endpoint(new AppServiceParameters(this, sender, parameters));
468468
}

components/AppServices/src/AppServiceHost.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ private void AppServiceConnection_RequestReceived(AppServiceConnection sender, A
204204
if (args.Request.Message.TryGetValue(ProgressKey, out object? progressKey) &&
205205
args.Request.Message.TryGetValue(ProgressValue, out object? progressValue) &&
206206
progressKey is Guid id &&
207-
_progressTrackers.TryGetValue(id, out IProgress<object> progress))
207+
_progressTrackers.TryGetValue(id, out IProgress<object>? progress))
208208
{
209-
progress.Report(progressValue);
209+
progress?.Report(progressValue);
210210
}
211211
}
212212

0 commit comments

Comments
 (0)