From 11d16508ca860baf16abda0cc84eeb50945eed1c Mon Sep 17 00:00:00 2001 From: Boy Date: Sat, 4 Feb 2023 00:40:48 +0100 Subject: [PATCH] fix nullpointer --- .../transition/ConfigSectionChecker.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/com/mineinabyss/deeperworld/movement/transition/ConfigSectionChecker.kt b/src/main/kotlin/com/mineinabyss/deeperworld/movement/transition/ConfigSectionChecker.kt index 6682714..d311497 100644 --- a/src/main/kotlin/com/mineinabyss/deeperworld/movement/transition/ConfigSectionChecker.kt +++ b/src/main/kotlin/com/mineinabyss/deeperworld/movement/transition/ConfigSectionChecker.kt @@ -24,13 +24,15 @@ object ConfigSectionChecker : SectionChecker { else -> null } ?: return null - return SectionTransition( - from, - corrLoc, - fromSection, - corrLoc.section!!, // If inSectionTransition, must be non-null - if (to.y < from.y) TransitionKind.DESCEND else TransitionKind.ASCEND, - teleportUnnecessary = fromSection != toSection - ) + return corrLoc.section?.let { + SectionTransition( + from, + corrLoc, + fromSection, + it, + if (to.y < from.y) TransitionKind.DESCEND else TransitionKind.ASCEND, + teleportUnnecessary = fromSection != toSection + ) + } } }