Open nilobarp opened 6 years ago
Can’t reproduce with same version.
nilobarp's example seems fine to me, no crash.
Encountered this with macOS 10.15.6 (19G2021) running MacDown 0.7.3.
<pre>
anywhere at document top-level (not nested in anything) triggers it on the closing angle bracket. <style>
; the opening tag auto-completes fine, but typing the closing tag causes a crash as soon as anything beyond </
is entered (the closing angle bracket is auto-completed).Note: I reproduced the latter after opening MacDown's executable (inside the .app bundle) to get the following stacktrace:
/Applications/MacDown.app/Contents/MacOS$ ./MacDown
2020-09-28 12:16:32.284 MacDown[49458:37419894] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSRegularExpression enumerateMatchesInString:options:range:usingBlock:]: nil argument'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff30d2bb57 __exceptionPreprocess + 250
1 libobjc.A.dylib 0x00007fff69bd85bf objc_exception_throw + 48
2 Foundation 0x00007fff333447a8 -[NSRegularExpression numberOfCaptureGroups] + 0
3 Foundation 0x00007fff33397173 -[NSRegularExpression(NSMatching) matchesInString:options:range:] + 146
4 Foundation 0x00007fff333a708b -[NSRegularExpression(NSReplacement) stringByReplacingMatchesInString:options:range:withTemplate:] + 176
5 MacDown 0x000000010242158f MacDown + 83343
6 MacDown 0x0000000102420d73 MacDown + 81267
7 Foundation 0x00007fff3332aac5 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
8 Foundation 0x00007fff3332a9e6 -[NSBlockOperation main] + 80
9 Foundation 0x00007fff3332a981 __NSOPERATION_IS_INVOKING_MAIN__ + 17
10 Foundation 0x00007fff33329bb3 -[NSOperation start] + 722
11 Foundation 0x00007fff333298d9 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
12 Foundation 0x00007fff333297a9 __NSOQSchedule_f + 182
13 libdispatch.dylib 0x00007fff6ad332b9 _dispatch_block_async_invoke2 + 83
14 libdispatch.dylib 0x00007fff6ad27658 _dispatch_client_callout + 8
15 libdispatch.dylib 0x00007fff6ad29818 _dispatch_continuation_pop + 414
16 libdispatch.dylib 0x00007fff6ad28f16 _dispatch_async_redirect_invoke + 703
17 libdispatch.dylib 0x00007fff6ad35957 _dispatch_root_queue_drain + 326
18 libdispatch.dylib 0x00007fff6ad36097 _dispatch_worker_thread2 + 92
19 libsystem_pthread.dylib 0x00007fff6af819f7 _pthread_wqthread + 220
20 libsystem_pthread.dylib 0x00007fff6af80b77 start_wqthread + 15
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
So it seems there's a problem in the use of the NSRegularExpression
API.
Take this line for instance
> Hello world
Now try editing it to> Hello <pre>world</pre>
MacDown crashes the moment I type
>
after<pre