瀏覽代碼

* explicit check for Nil in AnsiExtractQuotedString (bug 31212)

git-svn-id: trunk@35598 -
michael 8 年之前
父節點
當前提交
0ee31963ed
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      rtl/objpas/sysutils/sysstr.inc

+ 6 - 5
rtl/objpas/sysutils/sysstr.inc

@@ -678,13 +678,15 @@ function AnsiExtractQuotedStr(var  Src: PChar; Quote: Char): string;
 var
   P,Q,R: PChar;
 begin
+ result:='';
+ if P=Nil then exit;
  P := Src;
  Q := StrEnd(P);
- result:='';
- if P=Q then exit;
- if P^<>quote then exit(strpas(P));
+ if P=Q then 
+   exit;
+ if P^<>quote then 
+   exit(strpas(P));
  inc(p);
-
  setlength(result,(Q-P)+1);
  R:=@Result[1];
  while P <> Q do
@@ -1904,7 +1906,6 @@ var p : pchar;
 begin
   p:=pchar(pointer(s)); // work around CONST. Ansiextract is safe for nil
   result:=AnsiExtractquotedStr(p,AQuote);
-  
 end;
 
 function StrToBool(const S: string): Boolean;