Fixed: Access Violation in LoadFromString methods when not passing an Encoding explicitly

This commit is contained in:
Mark van Renswoude 2016-07-21 13:23:20 +00:00
parent 8feb95edb4
commit fe7f2eb952
1 changed files with 6 additions and 1 deletions

View File

@ -74,7 +74,12 @@ const
' stream: TStringStream;' + CrLf +
'' + CrLf +
'begin' + CrLf +
' stream := TStringStream.Create(AString{$IF CompilerVersion >= 20}, AEncoding, AOwnsEncoding{$IFEND});' + CrLf +
' {$IF CompilerVersion >= 20}' + CrLf +
' if Assigned(AEncoding) then' + CrLf +
' stream := TStringStream.Create(AString, AEncoding, AOwnsEncoding)' + CrLf +
' else' + CrLf +
' {$IFEND}' + CrLf +
' stream := TStringStream.Create(AString);' + CrLf +
' try' + CrLf +
' Result := Load%<Name>:sFromStream(stream);' + CrLf +
' finally' + CrLf +