Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 6c0d81e

Browse files
author
Mikhail Arkhipov
authored
Fix exception (#1145)
1 parent 905c6d2 commit 6c0d81e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/LanguageServer/Impl/Sources/DocumentationSource.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
// See the Apache Version 2.0 License for specific language governing
1414
// permissions and limitations under the License.
1515

16-
using System.Collections.Generic;
17-
using System.Linq;
16+
using System;
1817
using Microsoft.Python.Analysis;
1918
using Microsoft.Python.Analysis.Types;
2019
using Microsoft.Python.Core.Text;
@@ -50,8 +49,9 @@ private string[] GetFunctionParameters(IPythonFunctionType ft, out int[] paramet
5049
var o = ft.Overloads[overloadIndex]; // TODO: display all?
5150
var skip = ft.IsStatic || ft.IsUnbound ? 0 : 1;
5251

53-
var parameters = new string[o.Parameters.Count - skip];
54-
parameterNameLengths = new int[o.Parameters.Count - skip];
52+
var count = Math.Max(0, o.Parameters.Count - skip);
53+
var parameters = new string[count];
54+
parameterNameLengths = new int[count];
5555
for (var i = skip; i < o.Parameters.Count; i++) {
5656
string paramString;
5757
var p = o.Parameters[i];

0 commit comments

Comments
 (0)