I need to catch a fatal error thrown from this code, the error is bellow,
let contents: Any?
do {
contents = try Cstes.bufferECG_A.append(tmpECG)
} catch _ {
contents = nil
print("Catch the problem in Cstes.bufferECG_A")
}
error :
malloc: *** error for object 0x1c5430c80: pointer being freed was not
allocated
*** set a breakpoint in malloc_error_break to debug
and the swift compiler tells me the advice bellow:
'catch' block is unreachable because no errors are thrown in 'do' block
How can I make it work properly?