Crash when accessing unavailable Alias

Built with Xojo 2019r3.1 - when I use FolderItem.Child on an Alias, and if that Alias points to an unavailable file server, I get a hard crash because, obviously, Xojo’s code does not check if the returned handle is NULL, and then calls CFRetain with NULL, which leads to the crash.

Is this a known bug and has it been fixed? If yes, in which version?

Date/Time:             2021-02-22 09:38:05.397 +0100
OS Version:            Mac OS X 10.15.7 (19H524)
Report Version:        12
Bridge OS Version:     5.2 (18P4346)
Anonymous UUID:        6AEA8171-4823-424C-812A-F251CE4765AB


Time Awake Since Boot: 64 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Illegal instruction: 4
Termination Reason:    Namespace SIGNAL, Code 0x4
Terminating Process:   exc handler [797]

Application Specific Information:
*** CFRetain() called with NULL ***

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation      	0x00007fff306ae98f CFRetain.cold.1 + 14
1   com.apple.CoreFoundation      	0x00007fff30501a88 CFRetain + 109
2   com.apple.CoreServicesInternal	0x00007fff499566d2 _CreateByResolvingAliasFile(__CFAllocator const*, __CFURL const*, unsigned long, unsigned char*, __CFError**) + 54
3   com.apple.CoreServicesInternal	0x00007fff499564f8 _URLCreateByResolvingAliasFile + 48
4   com.apple.Foundation          	0x00007fff32cae480 -[NSURL(NSURL) initByResolvingAliasFileAtURL:options:error:] + 269
5   com.apple.Foundation          	0x00007fff32cae361 +[NSURL(NSURL) URLByResolvingAliasFileAtURL:options:error:] + 49
6   com.xojo.XojoFramework        	0x000000010ff9450f FolderItemImpNSURL::FolderItemImpNSURL(NSURL*, bool) + 81
7   com.xojo.XojoFramework        	0x000000010ff9651d FolderItemImpNSURL::GetChildByName(string, long) + 131
8   com.xojo.XojoFramework        	0x00000001100f8ca3 0x10fef9000 + 2096291
9   org.tempel.pgx.report         	0x000000010ea11493 FolderItem.Child%o<FolderItem>%o<FolderItem>sb + 83

Sounds like a cousin of <https://xojo.com/issue/59530>

1 Like