From fba9968a108912dec129eef5d0a340e85dbd8236 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 15 Apr 2019 19:47:19 +0200 Subject: [PATCH] Fixing crash and bug --- .../pokeranalytics/android/model/realm/Session.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt b/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt index 8d755280..73842543 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt +++ b/app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt @@ -800,7 +800,9 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat game = null } } - SessionRow.INITIAL_BUY_IN -> tournamentEntryFee = if (value == null) null else (value as String).toDouble() + SessionRow.INITIAL_BUY_IN -> { + this.tournamentEntryFee = (value as Double?) + } SessionRow.LOCATION -> location = value as Location? SessionRow.PLAYERS -> { if (value is Double) { @@ -829,9 +831,14 @@ open class Session : RealmObject(), Savable, Editable, StaticRowRepresentableDat } SessionRow.TOURNAMENT_NAME -> tournamentName = value as TournamentName? SessionRow.TOURNAMENT_TYPE -> tournamentType = value as Int? - SessionRow.TOURNAMENT_FEATURE -> value?.let { - tournamentFeatures = RealmList() - tournamentFeatures.addAll((it as ArrayList)) + SessionRow.TOURNAMENT_FEATURE -> { + + value?.let { + tournamentFeatures = RealmList() + tournamentFeatures.addAll((it as ArrayList)) + } ?: run { + tournamentFeatures.removeAll(this.tournamentFeatures) + } } } }