Occasional PDFKit crash at PageLayout::getWordRange(unsigned long, long)

At this line of code (SketchTextSelectionManager.swift:449), sometimes there will be crashes based on crashlytics reports.

let selection = pdfPage.selectionForWord(at: location)

This is directly calling into PDFKit's PDFPage#selection method: https://developer.apple.com/documentation/pdfkit/pdfpage/selectionforword(at:)

Attached the full stacktrace:

 Crashed: com.apple.root.user-initiated-qos.cooperative
0  CoreGraphics                   0x30c968 PageLayout::getWordRange(unsigned long, long) const + 908
1  CoreGraphics                   0x30bbc0 PageLayout::getTextRangeIndex(CGPoint, CGPDFSelectionType, SelectionPrecision) const + 2292
2  CoreGraphics                   0x44a53c CGPDFSelectionCreateBetweenPointsWithOptions + 384
3  PDFKit                         0x8d5f8 -[PDFPage selectionFromPoint:toPoint:type:] + 168
4  PDFKit                         0x92040 -[PDFPage _rvItemAtPoint:] + 64
5  PDFKit                         0x91f4c -[PDFPage rvItemAtPoint:] + 84
6  PDFKit                         0x8caa8 -[PDFPage selectionForWordAtPoint:] + 40
7  MyApp                       0x8420e0 closure #1 in SketchTextSelectionManager.startNewTextSelection(pageId:location:) + 449 (SketchTextSelectionManager.swift:449)
8  MyApp                       0x841a70 SketchTextSelectionManager.startNewTextSelection(pageId:location:) + 205 (CurrentNoteManager.swift:205)
9  libswift_Concurrency.dylib     0x61104 swift::runJobInEstablishedExecutorContext(swift::Job*) + 252
10 libswift_Concurrency.dylib     0x63a28 (anonymous namespace)::ProcessOutOfLineJob::process(swift::Job*) + 480
11 libswift_Concurrency.dylib     0x611c4 swift::runJobInEstablishedExecutorContext(swift::Job*) + 444
12 libswift_Concurrency.dylib     0x62514 swift_job_runImpl(swift::Job*, swift::SerialExecutorRef) + 144
13 libdispatch.dylib              0x15d8c _dispatch_root_queue_drain + 392
14 libdispatch.dylib              0x16590 _dispatch_worker_thread2 + 156
15 libsystem_pthread.dylib        0x4c40 _pthread_wqthread + 228
16 libsystem_pthread.dylib        0x1488 start_wqthread + 8
        ```
Occasional PDFKit crash at PageLayout::getWordRange(unsigned long, long)
 
 
Q