Add type check to Handle method in AnnotationHandler
Refactored the Handle method to include a type check for PsPdfKitAnnotation before creating an annotation. This prevents errors when the notification does not contain the expected annotation type.
This commit is contained in:
@@ -29,6 +29,9 @@ public class AnnotationHandler : INotificationHandler<DocSignedNotification>
|
|||||||
/// <param name="notification"></param>
|
/// <param name="notification"></param>
|
||||||
/// <param name="cancel"></param>
|
/// <param name="cancel"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task Handle(DocSignedNotification notification, CancellationToken cancel)
|
public async Task Handle(DocSignedNotification notification, CancellationToken cancel)
|
||||||
=> _repo.CreateAsync(notification.PsPdfKitAnnotation.Structured, cancel);
|
{
|
||||||
|
if (notification.PsPdfKitAnnotation is PsPdfKitAnnotation annot)
|
||||||
|
await _repo.CreateAsync(annot.Structured, cancel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user