From 6858457dbb905a611f9e61f94abb3412588c9448 Mon Sep 17 00:00:00 2001 From: gambas Date: Mon, 14 May 2018 01:18:11 +0200 Subject: [PATCH] Automatic completion: Don't crash when completing an unreadable directory. [DEVELOPMENT ENVIRONMENT] * BUG: Automatic completion: Don't crash when completing an unreadable directory. --- .../.src/Editor/Code/FCompletion.class | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/src/gambas3/.src/Editor/Code/FCompletion.class b/app/src/gambas3/.src/Editor/Code/FCompletion.class index 8ac8a4c44..2a653dd47 100644 --- a/app/src/gambas3/.src/Editor/Code/FCompletion.class +++ b/app/src/gambas3/.src/Editor/Code/FCompletion.class @@ -740,17 +740,18 @@ Private Sub FillWithFiles(sWord As String) sDir = Left(sDir, iPos) If Not IsDir(sDir) Then Return - aDir = Dir(sDir, "*").Sort(gb.IgnoreCase + gb.Natural) - - For Each sName In aDir - If bProject Then - If sName Ends "~" Then Continue - Endif - hPict = Desktop.GetFileIcon(sDir &/ sName, 16, True) - If Not hPict Then hPict = hPictFile - AddRow(CStr(MHelp.TYPE_FILE) & sName, sName, If(IsDir(sDir &/ sName), hPictDir, hPict)) - $iMaxLen = Max($iMaxLen, String.Len(sName)) - Next + Try aDir = Dir(sDir, "*").Sort(gb.IgnoreCase + gb.Natural) + If Not Error Then + For Each sName In aDir + If bProject Then + If sName Ends "~" Then Continue + Endif + hPict = Desktop.GetFileIcon(sDir &/ sName, 16, True) + If Not hPict Then hPict = hPictFile + AddRow(CStr(MHelp.TYPE_FILE) & sName, sName, If(IsDir(sDir &/ sName), hPictDir, hPict)) + $iMaxLen = Max($iMaxLen, String.Len(sName)) + Next + Endif Endif