From 467d5a3cf0bd50b8691ba8afd64b0a564cc14895 Mon Sep 17 00:00:00 2001 From: Andrey Uskov Date: Tue, 25 Dec 2018 13:58:12 +0300 Subject: [PATCH] Fix KNPE during move nested class to upper level (EA-128165) --- .../ui/KotlinSelectNestedClassRefactoringDialog.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/KotlinSelectNestedClassRefactoringDialog.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/KotlinSelectNestedClassRefactoringDialog.kt index a252f0daecd..e4cdb232a74 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/KotlinSelectNestedClassRefactoringDialog.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/move/moveDeclarations/ui/KotlinSelectNestedClassRefactoringDialog.kt @@ -85,8 +85,8 @@ internal class KotlinSelectNestedClassRefactoringDialog private constructor ( private fun MoveKotlinNestedClassesToUpperLevelDialog( nestedClass: KtClassOrObject, targetContainer: PsiElement? - ): MoveKotlinNestedClassesToUpperLevelDialog { - val outerClass = nestedClass.containingClassOrObject!! + ): MoveKotlinNestedClassesToUpperLevelDialog? { + val outerClass = nestedClass.containingClassOrObject ?: return null val newTarget = targetContainer ?: outerClass.containingClassOrObject ?: outerClass.containingFile.let { it.containingDirectory ?: it } @@ -119,7 +119,7 @@ internal class KotlinSelectNestedClassRefactoringDialog private constructor ( selectionDialog.getNextDialog() ?: return } } - dialog.show() + dialog?.show() } } } \ No newline at end of file