TGCameraViewController icon indicating copy to clipboard operation
TGCameraViewController copied to clipboard

Crash in [TGCamera setupWithFlashButton:], nil AVCaptureInput

Open tspop opened this issue 7 years ago • 0 comments

Can't reproduce the issue, happens rarely in production.

Seems like not checking for errors in this code is the offender, not sure what sort of error can be triggered here.

AVCaptureDeviceInput *deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:device error:nil];

Stack Trace:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCaptureSession addInput:] Can't add a nil AVCaptureInput' TGCamera.m, line 208

1	CoreFoundation	__exceptionPreprocess + 124
2	libobjc.A.dylib	objc_exception_throw + 52
3	AVFoundation	-[AVCaptureSession addInput:] + 900
4	TGCameraViewController	-[TGCamera setupWithFlashButton:] (TGCamera.m:208)
5	TGCameraViewController	+[TGCamera cameraWithFlashButton:] (TGCamera.m:58)
6	TGCameraViewController	-[TGCameraViewController viewDidLoad] (TGCameraViewController.m:117)
7	UIKit	-[UIViewController loadViewIfRequired] + 1036
8	UIKit	-[UINavigationController _updateScrollViewFromViewController:toViewController:] + 72
9	UIKit	-[UINavigationController _startTransition:fromViewController:toViewController:] + 192
10	UIKit	-[UINavigationController _startDeferredTransitionIfNeeded:] + 1164
11	UIKit	-[UINavigationController __viewWillLayoutSubviews] + 120
12	UIKit	-[UILayoutContainerView layoutSubviews] + 184
13	UIKit	0x1a2a6f000 + 595476
14	UIKit	_runAfterCACommitDeferredBlocks + 288
15	UIKit	_cleanUpAfterCAFlushAndRunDeferredBlocks + 284
16	UIKit	_afterCACommitHandler + 128
17	CoreFoundation	__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28
18	CoreFoundation	__CFRunLoopDoObservers + 408
19	CoreFoundation	__CFRunLoopRun + 1288
20	CoreFoundation	CFRunLoopRunSpecific + 432
21	GraphicsServices	GSEventRunModal + 96
22	UIKit	UIApplicationMain + 204
23	<Redacted>	main (AppDelegate.swift:18)
24	libdyld.dylib	start + 0

tspop avatar Oct 19 '17 12:10 tspop