Skip to content

Commit b2b395d

Browse files
committed
Adds index for better logging
1 parent fcc1b26 commit b2b395d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

kotlin/src/com/here/flexiblepolyline/FlexiblePolyline.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ object FlexiblePolyline {
115115
require(!(precision < 0 || precision > 15)) { "precision out of range" }
116116
require(!(thirdDimPrecision < 0 || thirdDimPrecision > 15)) { "thirdDimPrecision out of range" }
117117
require(!(thirdDimensionValue < 0 || thirdDimensionValue > 7)) { "thirdDimensionValue out of range" }
118-
val res = (thirdDimPrecision shl 7 or (thirdDimensionValue shl 4) or precision).toLong()
118+
val res = ((thirdDimPrecision shl 7) or (thirdDimensionValue shl 4) or precision).toLong()
119119
Converter.encodeUnsignedVarInt(VERSION, result)
120120
Converter.encodeUnsignedVarInt(res, result)
121121
}
@@ -248,10 +248,10 @@ object FlexiblePolyline {
248248
var shift: Short = 0
249249
var result: Long = 0
250250

251-
encoded.forEach {
252-
val value = decodeChar(it).toLong()
251+
encoded.withIndex().forEach {
252+
val value = decodeChar(it.value).toLong()
253253
if (value < 0) {
254-
throw IllegalArgumentException("Unexpected value found :: '$it")
254+
throw IllegalArgumentException("Unexpected value found :: '${it.value}' at ${it.index}")
255255
}
256256
result = result or ((value and 0x1FL) shl shift.toInt())
257257
if ((value and 0x20L) == 0L) {

0 commit comments

Comments
 (0)