Browse Source

* Fix access violation when file not found. Better GetCurColumn

git-svn-id: trunk@21932 -
michael 13 years ago
parent
commit
09275660d8
1 changed files with 6 additions and 2 deletions
  1. 6 2
      packages/fcl-passrc/src/pscanner.pp

+ 6 - 2
packages/fcl-passrc/src/pscanner.pp

@@ -928,6 +928,7 @@ Var
   FN : String;
 
 begin
+  Result:=Nil;
   FN:=FindIncludeFileName(ANAme);
   If (FN<>'') then
     try
@@ -1153,7 +1154,7 @@ begin
        param:=copy(param,2,length(param)-2);
     end;
   FCurSourceFile := FileResolver.FindIncludeFile(Param);
-  if not Assigned(CurSourceFile) then
+  if not Assigned(FCurSourceFile) then
     Error(SErrIncludeFileNotFound, [Param]);
   FCurFilename := Param;
   if FCurSourceFile is TFileLineReader then
@@ -1765,7 +1766,10 @@ end;
 
 function TPascalScanner.GetCurColumn: Integer;
 begin
-  Result := TokenStr - PChar(CurLine);
+  If (TokenStr<>Nil) then
+    Result := TokenStr - PChar(CurLine)
+  else
+    Result:=0;
 end;
 
 procedure TPascalScanner.DoLog(const Msg: String;SkipSourceInfo : Boolean = False);