Resolved #12893 - Fixed crash when moving selected spies via long-click

This commit is contained in:
yairm210 2025-02-26 23:28:56 +02:00
parent 733ad64f54
commit cb6d99ae20
2 changed files with 5 additions and 0 deletions

View File

@ -167,6 +167,8 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
fun update() {
closeButton.isVisible = true
if (!presenter.shouldBeShown()) summaryPresenter
presenter.update()
// more efficient to do this check once for both
@ -275,5 +277,6 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
fun update() {}
/** only called when [UnitTable.shouldUpdate] is true */
fun updateWhenNeeded() {}
fun shouldBeShown(): Boolean { return true}
}
}

View File

@ -17,6 +17,8 @@ class SpyPresenter(private val unitTable: UnitTable) : UnitTable.Presenter {
selectedSpy = spy
}
override fun shouldBeShown(): Boolean = selectedSpy != null
override fun updateWhenNeeded() = with(unitTable) {
val spy = selectedSpy!!
unitNameLabel.clearListeners()