Merge pull request #2517 from Wevah/mac-release
Crasher fixes (mac-release branch)
This commit is contained in:
commit
2d02295ce4
@ -202,10 +202,12 @@ private extension GeneralPreferencesViewController {
|
|||||||
menu.addItem(NSMenuItem.separator())
|
menu.addItem(NSMenuItem.separator())
|
||||||
|
|
||||||
for browser in allBrowsers {
|
for browser in allBrowsers {
|
||||||
let item = NSMenuItem(title: browser.name!, action: nil, keyEquivalent: "")
|
guard let name = browser.name else { continue }
|
||||||
|
|
||||||
|
let item = NSMenuItem(title: name, action: nil, keyEquivalent: "")
|
||||||
item.representedObject = browser.bundleIdentifier
|
item.representedObject = browser.bundleIdentifier
|
||||||
|
|
||||||
let icon = browser.icon!
|
let icon = browser.icon ?? NSWorkspace.shared.icon(forFileType: kUTTypeApplicationBundle as String)
|
||||||
icon.size = NSSize(width: 16.0, height: 16.0)
|
icon.size = NSSize(width: 16.0, height: 16.0)
|
||||||
item.image = browser.icon
|
item.image = browser.icon
|
||||||
menu.addItem(item)
|
menu.addItem(item)
|
||||||
|
@ -191,6 +191,8 @@ extension NSAttributedString {
|
|||||||
result.addAttribute(.font, value: baseFont, range: NSRange(location: 0, length: result.length))
|
result.addAttribute(.font, value: baseFont, range: NSRange(location: 0, length: result.length))
|
||||||
|
|
||||||
for (range, styles) in attributeRanges {
|
for (range, styles) in attributeRanges {
|
||||||
|
if range.location >= result.length { continue }
|
||||||
|
|
||||||
let currentFont = result.attribute(.font, at: range.location, effectiveRange: nil) as! Font
|
let currentFont = result.attribute(.font, at: range.location, effectiveRange: nil) as! Font
|
||||||
let currentDescriptor = currentFont.fontDescriptor
|
let currentDescriptor = currentFont.fontDescriptor
|
||||||
var descriptor = currentDescriptor.copy() as! FontDescriptor
|
var descriptor = currentDescriptor.copy() as! FontDescriptor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user