[Gambas-user] Bug: FEditor

Benoit Minisini gambas at ...1...
Thu Mar 18 23:21:47 CET 2004


On Thursday 18 March 2004 17:55, ron wrote:
> Hallo Benoit
>
> I had several times an error in FEditor with fatal result and closing all
> without it is saved. :(
>
> Function is IsCurrentProc()
> line 598
> ------------------
>  FOR iPos = 0 TO aLine.Count - 1
> .....
>     IF aLine[iPos] = "FUNCTION" THEN
>       bProc = TRUE
>       BREAK
>     ENDIF
>  ...
>   NEXT
>
>   IF bProc THEN $sName = aLine[iPos + 1]  '<----------- 598
>
>   RETURN bProc
> END
> ------------------
> I do not know when exactly this function runs but asuming FUNCTION can be
> the last line then iPos is already at the last line
> With the BREAK in continues after NEXT
> bProc=True and then iPos + 1  is out of bounds !

I just have fixed this bug! Replace:

  IF bProc THEN $sName = aLine[iPos + 1]  '<----------- 598

by the following:

  IF bProc THEN
  
    INC iPos
    IF iPos >= aLine.Count THEN RETURN

    $sName = aLine[iPos]
    
  ENDIF


Sorry for the bug!

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list