Automatic completion: Don't crash when completing an unreadable directory.

[DEVELOPMENT ENVIRONMENT]
* BUG: Automatic completion: Don't crash when completing an unreadable directory.
This commit is contained in:
gambas 2018-05-14 01:18:11 +02:00
parent df6bf93820
commit 6858457dbb

View file

@ -740,17 +740,18 @@ Private Sub FillWithFiles(sWord As String)
sDir = Left(sDir, iPos) sDir = Left(sDir, iPos)
If Not IsDir(sDir) Then Return If Not IsDir(sDir) Then Return
aDir = Dir(sDir, "*").Sort(gb.IgnoreCase + gb.Natural) Try aDir = Dir(sDir, "*").Sort(gb.IgnoreCase + gb.Natural)
If Not Error Then
For Each sName In aDir For Each sName In aDir
If bProject Then If bProject Then
If sName Ends "~" Then Continue If sName Ends "~" Then Continue
Endif Endif
hPict = Desktop.GetFileIcon(sDir &/ sName, 16, True) hPict = Desktop.GetFileIcon(sDir &/ sName, 16, True)
If Not hPict Then hPict = hPictFile If Not hPict Then hPict = hPictFile
AddRow(CStr(MHelp.TYPE_FILE) & sName, sName, If(IsDir(sDir &/ sName), hPictDir, hPict)) AddRow(CStr(MHelp.TYPE_FILE) & sName, sName, If(IsDir(sDir &/ sName), hPictDir, hPict))
$iMaxLen = Max($iMaxLen, String.Len(sName)) $iMaxLen = Max($iMaxLen, String.Len(sName))
Next Next
Endif
Endif Endif