Browse Source

* Fix AV in case there is no changelist (local dataset)

michael 7 years ago
parent
commit
53c1915185
1 changed files with 4 additions and 2 deletions
  1. 4 2
      packages/fcl-db/db.pas

+ 4 - 2
packages/fcl-db/db.pas

@@ -3973,7 +3973,8 @@ begin
     R:=AddToChangeList(usDeleted);
     R:=AddToChangeList(usDeleted);
     If Not TryDoing(@InternalDelete,OnDeleteError) then
     If Not TryDoing(@InternalDelete,OnDeleteError) then
       begin
       begin
-      RemoveFromChangeList(R);
+      if Assigned(R) then
+        RemoveFromChangeList(R);
       exit;
       exit;
       end;
       end;
 {$ifdef dsdebug}
 {$ifdef dsdebug}
@@ -4533,7 +4534,8 @@ begin
     Resync([]);
     Resync([]);
     // We get the new values here, since the bookmark should now be correct to find the record later on when doing applyupdates.
     // We get the new values here, since the bookmark should now be correct to find the record later on when doing applyupdates.
     R:=AddToChangeList(UpdateStates[wasInsert]);
     R:=AddToChangeList(UpdateStates[wasInsert]);
-    R.FBookmark:=BookMark;
+    if Assigned(R) then
+      R.FBookmark:=BookMark;
 {$ifdef dsdebug}
 {$ifdef dsdebug}
     writeln ('Post: Browse mode set');
     writeln ('Post: Browse mode set');
 {$endif}
 {$endif}