Don't crash when clicking on inexistent file

This commit is contained in:
Matthias Neeracher 2015-02-18 15:10:57 +01:00 committed by Matthias Neeracher
parent a3bc2be09b
commit c5f47d55a6

View File

@ -244,7 +244,7 @@ class ASProjDoc: NSDocument, NSOutlineViewDelegate, NSMenuDelegate, NSOpenSavePa
}
if let file = (selection as? ASFileItem) {
var enc : UInt = 0
editor.setString(NSString(contentsOfURL:file.url, usedEncoding:&enc, error:nil) as! String)
editor.setString(NSString(contentsOfURL:file.url, usedEncoding:&enc, error:nil) as? String ?? "")
editor.setMode(UInt(file.type.aceMode))
editor.alphaValue = 1.0
mainEditor = selection