Fix NPE in KotlinRunConfiguration & do not throw exception on unknown container type (EA-209426)

This commit is contained in:
Ilya Kirillov
2019-09-25 11:13:06 +03:00
parent 9deb7dc8d6
commit 016132c762
2 changed files with 2 additions and 1 deletions
@@ -277,6 +277,7 @@ public class KotlinRunConfiguration extends JetRunConfiguration {
private void updateMainClassName(PsiElement element) {
KtDeclarationContainer container = KotlinRunConfigurationProducer.Companion.getEntryPointContainer(element);
if (container == null) return;
String name = KotlinRunConfigurationProducer.Companion.getStartClassFqName(container);
if (name != null) {
MAIN_CLASS_NAME = name;
@@ -101,7 +101,7 @@ class KotlinRunConfigurationProducer : RunConfigurationProducer<KotlinRunConfigu
container.toLightClass()?.let { ClassUtil.getJVMClassName(it) }
}
}
else -> throw IllegalArgumentException("Invalid entry-point container: " + (container as PsiElement).text)
else -> null
}
private fun PsiElement.declarationContainer(strict: Boolean): KtDeclarationContainer? {