Closed RohiniK28 closed 3 weeks ago
We force-unwrap on malloc
failure because there is no recovery. Swift does not support running in environments where malloc
might fail, and we inherit that restriction. There is no point continuing in this case.
Actual behavior
The App can be crashed because of using forceful unwrapping of optional value.
Steps to reproduce
While creating a buffer, forceful unwrapping is done that is causing a crash.
static func _allocateAndPrepareRawMemory(bytes: _Capacity, allocator: Allocator) -> UnsafeMutableRawPointer {
Is there any possible reason behind forcefully unwrapping it. From what i know, forceful unwrapping is not a good approach to handle as it might cause app crash. Kindly let me know the inputs.