korlibs / korlibs/korge-dragonbones

The exceptions of nullable field

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
7
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Many field are nullable, but use !! in the calling place, which is very unsafe and easily lead to exceptions or crashes. such as:

image

W/System.err: java.lang.NullPointerException
W/System.err: at com.dragonbones.animation.AnimationState.getAnimationData(AnimationState.kt:1501)
W/System.err: at com.dragonbones.animation.Animation.advanceTime(Animation.kt:209)
W/System.err: at com.dragonbones.armature.Armature._advanceTime(Armature.kt:338)
W/System.err: at com.dragonbones.armature.Armature.advanceTime(Armature.kt:310)
W/System.err: at com.soywiz.korge.dragonbones.KorgeDbArmatureDisplay$1.invoke-eeKXlv4(KorgeDbArmatureDisplay.kt:67)
W/System.err: at com.soywiz.korge.dragonbones.KorgeDbArmatureDisplay$1.invoke(KorgeDbArmatureDisplay.kt:64)
W/System.err: at com.soywiz.korge.view.ViewKt$addUpdater$component$1.update-_rozLdE(View.kt:1648)
W/System.err: at com.soywiz.korge.view.ViewsKt.updateSingleViewWithViewsAll-rsF1gfE(Views.kt:644)
W/System.err: at com.soywiz.korge.view.Views.update-_rozLdE(Views.kt:412)
W/System.err: at com.soywiz.korge.view.Views.frameUpdateAndRender-_rozLdE(Views.kt:400)
W/System.err: at com.soywiz.korge.Korge$prepareViewsBase$15.invoke(Korge.kt:527)
W/System.err: at com.soywiz.korge.Korge$prepareViewsBase$15.invoke(Korge.kt:518)
W/System.err: at com.soywiz.korev.EventDispatcher$Mixin.dispatch(EventDispatcher.kt:50)
W/System.err: at com.soywiz.korgw.GameWindow.dispatchRenderEvent(GameWindow.kt:985)
W/System.err: at com.soywiz.korgw.GameWindow.frameRender(GameWindow.kt:580)
W/System.err: at com.soywiz.korgw.GameWindow.frame-LZ20uQo(GameWindow.kt:550)
W/System.err: at com.soywiz.korgw.GameWindow.frame-LZ20uQo$default(GameWindow.kt:547)

The above exception has a very low probability of occurrence, and there is no recurrence path.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at AnimationState.kt:1501 and follow the stack through Animation.kt:209 and Armature.kt:338 to identify which nullable field reaches the unsafe call. Review the related nullable-field call sites described in the issue and reproduce the reported animation update path if possible. Done means the reported NullPointerException path is handled without unsafe nullable access.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.