fix #2584
This commit is contained in:
parent
24a40ea8c0
commit
8de0dd15b5
6
TestSuite/shortstring3.pas
Normal file
6
TestSuite/shortstring3.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
begin
|
||||||
|
var s: string[1];
|
||||||
|
var s0: string := nil;
|
||||||
|
s := s0;
|
||||||
|
assert(s = '');
|
||||||
|
end.
|
||||||
|
|
@ -13677,7 +13677,9 @@ end;
|
||||||
[System.Diagnostics.DebuggerStepThrough]
|
[System.Diagnostics.DebuggerStepThrough]
|
||||||
function ClipShortString(s: string; len: integer): string;
|
function ClipShortString(s: string; len: integer): string;
|
||||||
begin
|
begin
|
||||||
if s.Length <= len then
|
if s = nil then
|
||||||
|
Result := ''
|
||||||
|
else if s.Length <= len then
|
||||||
Result := s
|
Result := s
|
||||||
else Result := s.Substring(0, len);
|
else Result := s.Substring(0, len);
|
||||||
end;
|
end;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue