File tree 1 file changed +7
-5
lines changed
iOSDFULibrary/Classes/Implementation
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -37,12 +37,14 @@ internal enum DFURemoteError : Int {
37
37
case buttonless = 90
38
38
case experimentalButtonless = 9000
39
39
40
+ /// Returns a representative ``DFUError``
41
+ ///
42
+ /// The only available codes that this method is called with are
43
+ /// hardcoded in the library (ButtonlessDFU, DFUControlPoint,
44
+ /// SecureDFUControlPoint). But, we have seen crashes so,
45
+ /// we are returning ``DFUError.unsupportedResponse`` if a code is not found.
40
46
func with( code: UInt8 ) -> DFUError {
41
- // The force-unwrap here is used, as the only available codes
42
- // that this method is called with are hardcoded in the library
43
- // (ButtonlessDFU, DFUControlPoint, SecureDFUControlPoint)
44
- // and, with the optional offset, will match an existing DFUError.
45
- return DFUError ( rawValue: Int ( code) + rawValue) !
47
+ return DFUError ( rawValue: Int ( code) + rawValue) ?? . unsupportedResponse
46
48
}
47
49
}
48
50
You can’t perform that action at this time.
0 commit comments