Protect against some missing keys
This commit is contained in:
parent
78c36c9acf
commit
50d532aac9
1 changed files with 21 additions and 15 deletions
|
@ -410,6 +410,7 @@ class Document: NSDocument {
|
|||
info.videoFrame = parsePairString(frameSize)!
|
||||
|
||||
let colorProfileClassKey = dict["colorProfile"]
|
||||
if colorProfileClassKey != nil {
|
||||
let colorProfileClassID = getClassID(id: colorProfileClassKey)
|
||||
let colorProfile = objectsArray[colorProfileClassID] as! NSDictionary
|
||||
|
||||
|
@ -421,6 +422,9 @@ class Document: NSDocument {
|
|||
if colorProfileName == "Display P3" {
|
||||
info.colorSpace = CGColorSpace(name: CGColorSpace.displayP3)!
|
||||
}
|
||||
} else {
|
||||
info.colorSpace = CGColorSpace(name: CGColorSpace.displayP3)!
|
||||
}
|
||||
|
||||
let backgroundClassKey = dict["backgroundColor"]
|
||||
let backgroundClassID = getClassID(id: backgroundClassKey)
|
||||
|
@ -448,12 +452,14 @@ class Document: NSDocument {
|
|||
}
|
||||
|
||||
let authorClassKey = dict[AuthorNameKey]
|
||||
if authorClassKey != nil {
|
||||
let authorClassID = getClassID(id: authorClassKey)
|
||||
let authorString = objectsArray[authorClassID] as! String
|
||||
|
||||
if authorString != "$null" {
|
||||
info.authorName = authorString
|
||||
}
|
||||
}
|
||||
|
||||
let sizeClassKey = dict[SizeKey]
|
||||
let sizeClassID = getClassID(id: sizeClassKey)
|
||||
|
|
Reference in a new issue