Browse Source

+ Patch to return nil if there is no exception object (as in Delphi)

michael 20 years ago
parent
commit
71f56b3d61
1 changed files with 8 additions and 8 deletions
  1. 8 8
      rtl/inc/except.inc

+ 8 - 8
rtl/inc/except.inc

@@ -57,7 +57,7 @@ end;
 function AcquireExceptionObject: Pointer;
 function AcquireExceptionObject: Pointer;
 begin
 begin
   If ExceptObjectStack=nil then begin
   If ExceptObjectStack=nil then begin
-    runerror(231); // which error?
+    AcquireExceptionObject := nil
   end else begin
   end else begin
     Inc(ExceptObjectStack^.refcount);
     Inc(ExceptObjectStack^.refcount);
     AcquireExceptionObject := ExceptObjectStack^.FObject;
     AcquireExceptionObject := ExceptObjectStack^.FObject;
@@ -66,15 +66,12 @@ end;
 
 
 procedure ReleaseExceptionObject;
 procedure ReleaseExceptionObject;
 begin
 begin
-  If ExceptObjectStack=nil then begin
-    runerror(231); // which error?
-  end else begin
-    if ExceptObjectStack^.refcount = 0 then begin
-      runerror(231); // which error?
-    end;
+  If ExceptObjectStack <> nil then begin
+    if ExceptObjectStack^.refcount > 0 then begin
     Dec(ExceptObjectStack^.refcount);
     Dec(ExceptObjectStack^.refcount);
   end;
   end;
 end;
 end;
+end;
 
 
 {$ifndef HAS_ADDR_STACK_ON_STACK}
 {$ifndef HAS_ADDR_STACK_ON_STACK}
 Function fpc_PushExceptAddr (Ft: Longint): PJmp_buf ;
 Function fpc_PushExceptAddr (Ft: Longint): PJmp_buf ;
@@ -349,7 +346,10 @@ begin
 end;
 end;
 {
 {
   $Log$
   $Log$
-  Revision 1.20  2005-04-03 11:32:05  florian
+  Revision 1.21  2005-05-08 21:20:26  michael
+  + Patch to return nil if there is no exception object (as in Delphi)
+
+  Revision 1.20  2005/04/03 11:32:05  florian
     * ref. counting for popping second exceptiono object fixed
     * ref. counting for popping second exceptiono object fixed
 
 
   Revision 1.19  2005/02/14 17:13:22  peter
   Revision 1.19  2005/02/14 17:13:22  peter