Fix out of bounds access in complete.d when there is no paren.
`goBackToOpenParen` can return size_t.max, which the calling code in `getCalltipHint` did not handle (and accidentally returns via an `out` parameter). Check for this case so we don't get an array length error.
This commit is contained in:
parent
8a693954d3
commit
ed187e0c50
|
|
@ -361,7 +361,12 @@ CalltipHint getCalltipHint(T)(T beforeTokens, out size_t parenIndex)
|
||||||
// evaluate at comma case
|
// evaluate at comma case
|
||||||
if (beforeTokens.isComma)
|
if (beforeTokens.isComma)
|
||||||
{
|
{
|
||||||
parenIndex = beforeTokens.goBackToOpenParen;
|
size_t tmp = beforeTokens.goBackToOpenParen;
|
||||||
|
if(tmp == size_t.max){
|
||||||
|
return CalltipHint.regularArguments;
|
||||||
|
}
|
||||||
|
parenIndex = tmp;
|
||||||
|
|
||||||
// check if we are actually a "!("
|
// check if we are actually a "!("
|
||||||
if (beforeTokens[0 .. parenIndex].isTemplateBangParen)
|
if (beforeTokens[0 .. parenIndex].isTemplateBangParen)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue