Getting a crash randomly on this line:
return CGFloat(self[pixelPointer + offset] as? UInt8 ?? 0) / 255.0
in UIImage+RawPixels.swift
Thread 1 Queue : com.apple.main-thread (serial)
#0 0x00000001a7b2482c in swift::metadataimpl::ValueWitnesses<swift::metadataimpl::NativeBox<unsigned char, 1ul, 1ul, 1ul> >::initializeWithCopy(swift::OpaqueValue*, swift::OpaqueValue*, swift::TargetMetadata<swift::InProcess> const*) ()
#1 0x00000001041e9768 in byte #1 <τ_0_0>(_:) in UnsafePointer.colorAt(x:y:options:) at /Users/kashif/Dropbox/Tech Positive/Projects/iOS Projects/CoolDraw/Pods/CGPathIntersection/CGPathIntersection/UIImage+RawPixels.swift:42
#2 0x00000001041e9570 in UnsafePointer.colorAt(x:y:options:) at /Users/kashif/Dropbox/Tech Positive/Projects/iOS Projects/CoolDraw/Pods/CGPathIntersection/CGPathIntersection/UIImage+RawPixels.swift:46
#3 0x00000001041e72ec in CGPathImage.intersectionPoints(with:) at /Users/kashif/Dropbox/Tech Positive/Projects/iOS Projects/CoolDraw/Pods/CGPathIntersection/CGPathIntersection/CGPathImage.swift:76
#4 0x00000001041e6310 in CGPathRef.intersectionPoints(with:) at /Users/kashif/Dropbox/Tech Positive/Projects/iOS Projects/CoolDraw/Pods/CGPathIntersection/CGPathIntersection/CGPath+Intersections.swift:21
#5 0x00000001041e6248 in CGPathRef.intersects(_:) at /Users/kashif/Dropbox/Tech Positive/Projects/iOS Projects/CoolDraw/Pods/CGPathIntersection/CGPathIntersection/CGPath+Intersections.swift:14
#6 0x0000000104029268 in ViewController.touchesEnded(_:with:) at /Users/kashif/Dropbox/Tech Positive/Projects/iOS Projects/CoolDraw/CoolDraw/ViewController.swift:233
#7 0x0000000104029504 in @objc ViewController.touchesEnded(_:with:) ()
#8 0x00000001a665ecb4 in forwardTouchMethod ()
#9 0x00000001a666d500 in -[UIWindow _sendTouchesForEvent:] ()
#10 0x00000001a666ee20 in -[UIWindow sendEvent:] ()
#11 0x00000001a66488c0 in -[UIApplication sendEvent:] ()
#12 0x00000001a66d1d38 in __dispatchPreprocessedEventFromEventQueue ()
#13 0x00000001a66d674c in __processEventQueue ()
#14 0x00000001a66cdb4c in __eventFetcherSourceCallback ()
#15 0x00000001a3bb1990 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#16 0x00000001a3bb188c in __CFRunLoopDoSource0 ()
#17 0x00000001a3bb0b90 in __CFRunLoopDoSources0 ()
#18 0x00000001a3baab70 in __CFRunLoopRun ()
#19 0x00000001a3baa308 in CFRunLoopRunSpecific ()
#20 0x00000001bb22d734 in GSEventRunModal ()
#21 0x00000001a662875c in -[UIApplication _run] ()
#22 0x00000001a662dfcc in UIApplicationMain ()
#23 0x00000001b79af24c in UIApplicationMain(_:_:_:_:) ()
#24 0x000000010402b748 in static UIApplicationDelegate.main() ()
#25 0x000000010402b6c0 in static AppDelegate.$main() at /Users/kashif/Dropbox/Tech Positive/Projects/iOS Projects/CoolDraw/CoolDraw/AppDelegate.swift:10
#26 0x000000010402b7e0 in main ()
#27 0x00000001a3866cf8 in start ()
Getting a crash randomly on this line:
return CGFloat(self[pixelPointer + offset] as? UInt8 ?? 0) / 255.0in UIImage+RawPixels.swift