Skip to content

Crash on [AVCaptureSession addInput:] #72

@elikohen

Description

@elikohen

There are no checks for errors when AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:device error:nil] so if an error occurs, deviceInput will be nil and the following call to [_session addInput:deviceInput] will crash.

We cannot reproduce it on development, but we see several crashes on our production app on crashlytics:

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x184aa51b8 __exceptionPreprocess
1  libobjc.A.dylib                0x1834dc55c objc_exception_throw
2  AVFoundation                   0x18c287c70 -[AVCaptureSession addInput:]
3  FastttCamera                   0x100f42170 __36-[FastttCamera _setupCaptureSession]_block_invoke.150 (FastttCamera.m:436)
4  libdispatch.dylib              0x18392e1fc _dispatch_call_block_and_release
5  libdispatch.dylib              0x18392e1bc _dispatch_client_callout
6  libdispatch.dylib              0x183932d68 _dispatch_main_queue_callback_4CF
7  CoreFoundation                 0x184a52810 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
8  CoreFoundation                 0x184a503fc __CFRunLoopRun
9  CoreFoundation                 0x18497e2b8 CFRunLoopRunSpecific
10 GraphicsServices               0x186432198 GSEventRunModal
11 UIKit                          0x18a9c57fc -[UIApplication _run]
12 UIKit                          0x18a9c0534 UIApplicationMain

Is there any reason why there are no such checks?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions