From d7d3809128b8629aeb34e1436df5a532f9144529 Mon Sep 17 00:00:00 2001 From: Ludeck Date: Tue, 18 Mar 2025 02:27:03 +0000 Subject: [PATCH] Do extra check before the processDirtyFlag stuff to avoid null pointer --- src/client/js/services/record-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/js/services/record-handler.ts b/src/client/js/services/record-handler.ts index 315f89d0..f1c4cce3 100644 --- a/src/client/js/services/record-handler.ts +++ b/src/client/js/services/record-handler.ts @@ -769,7 +769,7 @@ module fng.services { $scope.$watch( "record", function (newValue, oldValue) { - if ($scope.phase === "ready" && !$scope.dirtyChecked && Object.keys(oldValue).length > 0 && $scope.topLevelFormName && $scope[$scope.topLevelFormName].$dirty && typeof $scope.dataEventFunctions?.checkDirty === "function") { + if ($scope.phase === "ready" && !$scope.dirtyChecked && Object.keys(oldValue).length > 0 && $scope.topLevelFormName && $scope[$scope.topLevelFormName] && $scope[$scope.topLevelFormName].$dirty && typeof $scope.dataEventFunctions?.checkDirty === "function") { $scope.dirtyChecked = true; // An opportunity to ask whether we can edit this document or not - pessimistic locking can be implemented by using this const checkDirty = $scope.dataEventFunctions.checkDirty(newValue, oldValue);