If we follow the logic of the MySQLTime conversion of TIMESTAMP text to MySQLTime, we can find that point of crash.
public init?(_ string: String) {
...
guard parts.count >= 6,
let year = UInt16(parts[0]),
let month = UInt16(parts[1]),
let day = UInt16(parts[2]),
let hour = UInt16(parts[3]),
let minute = UInt16(parts[4]),
let second = UInt16(parts[5]) // <- `parts[5]` is "01.000000" actually. Conversion to `UInt16` fails because of microseconds.
else {
return nil
}
...
}
So we added code to parse the real number text correctly.
Crash occurred even parsing logic enhanced by #72.
When you get rows from the simple query with
TIMESTAMP
column like this.Application crashed at
MySQLData.swift:459
due to forced unwrapping oftime
with a value ofnil
.If we follow the logic of the
MySQLTime
conversion ofTIMESTAMP
text toMySQLTime
, we can find that point of crash.So we added code to parse the real number text correctly.