Skip to content

Commit

Permalink
only lookup the page when the manifest actually exists
Browse files Browse the repository at this point in the history
  • Loading branch information
frett committed Dec 18, 2024
1 parent 9a1eaea commit 367a601
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import androidx.annotation.LayoutRes
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.asLiveData
import androidx.lifecycle.map
import javax.inject.Inject
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.map
import org.ccci.gto.android.common.androidx.fragment.app.findListener
import org.ccci.gto.android.common.androidx.lifecycle.notNull
Expand Down Expand Up @@ -62,7 +62,7 @@ abstract class CyoaPageFragment<B : ViewDataBinding, C : BaseController<*>>(@Lay
// region Page
internal var pageId by arg<String>()
private set
internal val page by lazy { dataModel.manifest.map { it?.findPage(pageId) }.asLiveData() }
internal val page by lazy { dataModel.manifest.filterNotNull().map { it.findPage(pageId) }.asLiveData() }

init {
page?.let { pageId = page }
Expand Down

0 comments on commit 367a601

Please sign in to comment.