Skip to content

Commit adb386e

Browse files
committed
adding try/catch
1 parent 362bdd3 commit adb386e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Python/Product/PythonTools/PythonTools/LanguageServerClient/PythonLanguageClient.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,12 @@ private LanguageServerSettings.PythonSettings GetSettings(Uri scopeUri = null) {
377377
context = _clientContexts.Find(c => c.RootPath == null);
378378
if (context == null) {
379379
// use first clientcontext as default
380-
context = _clientContexts.First();
381-
}
380+
try {
381+
context = _clientContexts.First();
382+
} catch (InvalidOperationException) {
383+
// no client context
384+
return null;
385+
}
382386
} else {
383387
var pathFromScopeUri = CommonUtils.NormalizeDirectoryPath(scopeUri.LocalPath).ToLower().TrimStart('\\');
384388
// Find the matching context for the item, but ignore interactive window where "RootPath" is null.

0 commit comments

Comments
 (0)