From c34e6fe66a082167f8dceeed0a0635ca9078d554 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Wed, 9 Sep 2020 23:52:21 -0700 Subject: [PATCH] Protect against invalid fixit for adding method --- IDEHelper/Compiler/BfExprEvaluator.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 20225363..9e1e2ba6 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -7529,15 +7529,17 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp if (targetType != NULL) { auto typeInst = targetType->ToTypeInstance(); - - BfTypeVector paramTypes; - for (int argIdx = 0; argIdx < (int)argValues.mResolvedArgs.size(); argIdx++) + if ((targetType != NULL) && (!methodName.IsEmpty())) { - auto& resolvedArg = argValues.mResolvedArgs[argIdx]; - paramTypes.Add(resolvedArg.mTypedValue.mType); - } + BfTypeVector paramTypes; + for (int argIdx = 0; argIdx < (int)argValues.mResolvedArgs.size(); argIdx++) + { + auto& resolvedArg = argValues.mResolvedArgs[argIdx]; + paramTypes.Add(resolvedArg.mTypedValue.mType); + } - autoComplete->FixitAddMethod(typeInst, methodName, mExpectingType, paramTypes, wantStatic); + autoComplete->FixitAddMethod(typeInst, methodName, mExpectingType, paramTypes, wantStatic); + } } }