mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Drop the last character for string length validation, bump version
This commit is contained in:
parent
7acb6aad32
commit
aa08f2ff33
11 changed files with 21 additions and 101 deletions
|
|
@ -53,11 +53,7 @@ struct WaypointFormMapKit: View {
|
|||
let totalBytes = name.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 30 {
|
||||
let firstNBytes = Data(name.utf8.prefix(30))
|
||||
if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) {
|
||||
// Set the name back to the last place where it was the right size
|
||||
name = maxBytesString
|
||||
}
|
||||
name = String(name.dropLast())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -74,11 +70,7 @@ struct WaypointFormMapKit: View {
|
|||
let totalBytes = description.utf8.count
|
||||
// Only mess with the value if it is too big
|
||||
if totalBytes > 100 {
|
||||
let firstNBytes = Data(description.utf8.prefix(100))
|
||||
if let maxBytesString = String(data: firstNBytes, encoding: String.Encoding.utf8) {
|
||||
// Set the name back to the last place where it was the right size
|
||||
description = maxBytesString
|
||||
}
|
||||
description = String(description.dropLast())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue