diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/io/BTreeDB.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/io/BTreeDB.kt index bb4c9f40..01d76cc6 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/io/BTreeDB.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/io/BTreeDB.kt @@ -30,9 +30,9 @@ private operator fun ByteArray.compareTo(b: ByteArray): Int { require(size == b.size) { "Keys are not of same size (${size} vs ${b.size})" } for (i in indices) { - if (this[i] > b[i]) { + if (this[i].toInt() and 0xFF > b[i].toInt() and 0xFF) { return 1 - } else if (this[i] < b[i]) { + } else if (this[i].toInt() and 0xFF < b[i].toInt() and 0xFF) { return -1 } }