NSPopUpButtonCell -drawTitle:withFrame:inView: crashes with empty attributed string

Originator:craig.hockenberry
Number:rdar://17917599 Date Originated:05-Aug-2014
Status:Open Resolved:
Product:OS X SDK Product Version:Xcode 6.0 (6A279r) / Yosemite 14A314h
Classification:Crash Reproducible:Always
 
Summary:
Passing an empty NSAttributedString to NSPopUpButtonCell's -drawTitle:withFrame:inView: causes an NSRangeException with a reason: 'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds'

Steps to Reproduce:
1) Open the attached project and run the app.
2) Watch the debug console.

Expected Results:
The app should display a customized popup menu title in the popup menus.

Actual Results:
The app crashes with an uncaught exception in the debug console.

Version:
Xcode 6.0 (6A279r) / Yosemite 14A314h

Notes:
The call to -drawTitle:withFrame:inView: will work if the empty string has no attributes or if the attributed string's length is not zero.

This is a regression. The following code worked fine in prior OS X releases (including Yosemite DP 4.)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!