Browse Source

* try to avoid incompatibility with lazarus (and possibly others)

Michaël Van Canneyt 11 months ago
parent
commit
edde858cfa
1 changed files with 5 additions and 1 deletions
  1. 5 1
      rtl/objpas/classes/stringl.inc

+ 5 - 1
rtl/objpas/classes/stringl.inc

@@ -1946,7 +1946,11 @@ begin
         DupIgnore : Exit;
         DupIgnore : Exit;
         DupError : Error(SDuplicateString,0)
         DupError : Error(SDuplicateString,0)
       end;
       end;
-   InsertItem (Result,S,AObject);
+   // Avoid crash in lazarus   
+   if Assigned(aObject) then   
+     InsertItem (Result,S,AObject)
+   else
+     InsertItem (Result,S);  
 end;
 end;
 
 
 function TStringList.Add(const S: string): Integer;
 function TStringList.Add(const S: string): Integer;