소스 검색

Protect against invalid fixit for adding method

Brian Fiete 5 년 전
부모
커밋
c34e6fe66a
1개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 9 7
      IDEHelper/Compiler/BfExprEvaluator.cpp

+ 9 - 7
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);
+				}
 			}			
 		}