<div dir="ltr"><div>The below program demonstrates a possible bug that I encountered.</div>Can anyone else reproduce my results (as explained in the comments)?<div>If so, is it a Swift or Cocoa bug (I haven&#39;t tried it in Objective C)?</div><div><div><br></div><div>import AppKit</div><div><br></div><div>extension NSFont {</div><div>    var planesWithMembers: [UInt8] {</div><div>        return (UInt8(0) ... UInt8(255)).filter {</div><div>            // The follwing line will crash (EXC_BAD_ACCESS) for some fonts:</div><div>            coveredCharacterSet.hasMember(inPlane: $0)</div><div>            // I have tested it with Xcode 8.3.3 and Xcode 9 beta 1, both</div><div>            // Swift 3 and 4, and they all reproduce the crash.</div><div>            // macOS 10.12.5</div><div>        }</div><div>    }</div><div>}</div><div><br></div><div>// Examples that will not cause the crash:</div><div>// let fontName = &quot;AlBayan&quot;</div><div>// let fontName = &quot;AppleBraille&quot;</div><div>// let fontName = &quot;Chalkboard&quot;</div><div>// let fontName = &quot;Helvetica&quot;</div><div>// let fontName = &quot;Zapfino&quot;</div><div><br></div><div>// Examples that will cause the crash:</div><div>// let fontName = &quot;AppleColorEmoji&quot;</div><div>// let fontName = &quot;AppleSymbols&quot;</div><div>let fontName = &quot;Baskerville&quot;</div><div>// let fontName = &quot;Geneva&quot;</div><div>// let fontName = &quot;SnellRoundhand&quot;</div><div><br></div><div>let font = NSFont(name: fontName, size: 12)!</div><div>let result = font.planesWithMembers</div><div>print(&quot;Planes that contains members:&quot;, result)</div></div><div><br></div></div>