mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 10:45:08 +02:00
* fixed strpos() in case source or target is nil
+ added test for this git-svn-id: trunk@1907 -
This commit is contained in:
parent
830d9956a9
commit
9b9dd342c5
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -5422,6 +5422,7 @@ tests/test/tstring4.pp svneol=native#text/plain
|
||||
tests/test/tstring5.pp svneol=native#text/plain
|
||||
tests/test/tstring6.pp svneol=native#text/plain
|
||||
tests/test/tstring7.pp svneol=native#text/plain
|
||||
tests/test/tstring8.pp svneol=native#text/plain
|
||||
tests/test/tstrreal1.pp svneol=native#text/plain
|
||||
tests/test/tstrreal2.pp svneol=native#text/plain
|
||||
tests/test/tsubdecl.pp svneol=native#text/plain
|
||||
|
@ -47,6 +47,8 @@
|
||||
lstr2 : SizeInt;
|
||||
begin
|
||||
strpos:=nil;
|
||||
if (str1 = nil) or (str2 = nil) then
|
||||
exit;
|
||||
p:=strscan(str1,str2^);
|
||||
if p=nil then
|
||||
exit;
|
||||
|
13
tests/test/tstring8.pp
Normal file
13
tests/test/tstring8.pp
Normal file
@ -0,0 +1,13 @@
|
||||
uses strings;
|
||||
|
||||
var
|
||||
a, b: pchar;
|
||||
|
||||
begin
|
||||
a := nil;
|
||||
b := 'abc';
|
||||
if (strpos(a,b) <> nil) or
|
||||
(strpos(b,a) <> nil) or
|
||||
(strpos(a,a) <> nil) then
|
||||
halt(1);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user