From 5c675be0ed0cb4884a63ff20ac87ed9472bacf47 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 20 Jan 2026 13:57:52 +0100 Subject: [PATCH] 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. --- .../Notifications/DocSigned/Handlers/AnnotationHandler.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Application/Common/Notifications/DocSigned/Handlers/AnnotationHandler.cs b/EnvelopeGenerator.Application/Common/Notifications/DocSigned/Handlers/AnnotationHandler.cs index 044f009f..3b33cd76 100644 --- a/EnvelopeGenerator.Application/Common/Notifications/DocSigned/Handlers/AnnotationHandler.cs +++ b/EnvelopeGenerator.Application/Common/Notifications/DocSigned/Handlers/AnnotationHandler.cs @@ -29,6 +29,9 @@ public class AnnotationHandler : INotificationHandler /// /// /// - public Task Handle(DocSignedNotification notification, CancellationToken cancel) - => _repo.CreateAsync(notification.PsPdfKitAnnotation.Structured, cancel); + public async Task Handle(DocSignedNotification notification, CancellationToken cancel) + { + if (notification.PsPdfKitAnnotation is PsPdfKitAnnotation annot) + await _repo.CreateAsync(annot.Structured, cancel); + } } \ No newline at end of file