Skip to content

Commit

Permalink
crash fixes, new version
Browse files Browse the repository at this point in the history
  • Loading branch information
Helium314 committed Nov 29, 2023
1 parent 5922b94 commit a9784f5
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ android {
applicationId = "de.westnordost.streetcomplete.expert"
minSdk = 21
targetSdk = 33
versionCode = 5501
versionName = "55.1"
versionCode = 5502
versionName = "55.11"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ class MapDataWithEditsSource internal constructor(
}
return sequence {
val waysContainingNode = getWaysForNode(movedNode.id)
if (waysContainingNode.any { getWayComplete(it.id) == null })
return@sequence // maybe this helps?
val relationsContainingNode = getRelationsForNode(movedNode.id)
val relationsContainingWayContainingNode = waysContainingNode.flatMap { getRelationsForWay(it.id) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class OsmQuestController internal constructor(
// must be valid names!
// todo: use actual class names, or better re-evaluate whether this is worth it and maybe invert to blacklist
private val questsRequiringElementsWithoutTags = hashSetOf("AddBarrierOnRoad", "AddBarrierOnPath", "AddCrossing",
"AddMaxHeight", "AddEntrance", "AddEntranceReference", "AddHousenumber", "AddDestination", "AddPisteDifficulty", "AddPisteRef")
"AddMaxHeight", "AddEntrance", "AddEntranceReference", "AddHousenumber", "AddDestination", "AddPisteDifficulty", "AddPisteRef", "AddPisteLit")

private val hiddenCache by lazy { synchronized(this) { hiddenDB.getAllIds().toHashSet() } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class AddPisteDifficulty : OsmFilterQuestType<PisteDifficulty>() {
override val defaultDisabledMessage: Int = R.string.default_disabled_msg_ee

override fun getApplicableElements(mapData: MapDataWithGeometry): Iterable<Element> {
return if (isWinter(mapData.nodes.first().position)) mapData.filter(filter).asIterable()
return if (isWinter(mapData.nodes.firstOrNull()?.position)) mapData.filter(filter).asIterable()
else emptyList()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AddPisteLit : OsmFilterQuestType<Boolean>() {
override val defaultDisabledMessage = R.string.default_disabled_msg_ee

override fun getApplicableElements(mapData: MapDataWithGeometry): Iterable<Element> {
return if (isWinter(mapData.nodes.first().position)) mapData.filter(filter).asIterable()
return if (isWinter(mapData.nodes.firstOrNull()?.position)) mapData.filter(filter).asIterable()
else emptyList()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AddPisteRef : OsmFilterQuestType<PisteRefAnswer>() {
override val defaultDisabledMessage = R.string.default_disabled_msg_ee

override fun getApplicableElements(mapData: MapDataWithGeometry): Iterable<Element> {
return if (isWinter(mapData.nodes.first().position)) mapData.filter(filter).asIterable()
return if (isWinter(mapData.nodes.firstOrNull()?.position)) mapData.filter(filter).asIterable()
else emptyList()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import de.westnordost.streetcomplete.util.ktx.systemTimeNow
import de.westnordost.streetcomplete.util.ktx.toLocalDate
import java.time.Month.*

fun isWinter(location: LatLon): Boolean {
fun isWinter(location: LatLon?): Boolean {
if (location == null) return false
val now = systemTimeNow().toLocalDate()
val winterSeason = if (location.latitude > 0)
listOf(NOVEMBER, DECEMBER, JANUARY, FEBRUARY, MARCH, APRIL)
Expand Down

0 comments on commit a9784f5

Please sign in to comment.