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)!
|
info.videoFrame = parsePairString(frameSize)!
|
||||||
|
|
||||||
let colorProfileClassKey = dict["colorProfile"]
|
let colorProfileClassKey = dict["colorProfile"]
|
||||||
|
if colorProfileClassKey != nil {
|
||||||
let colorProfileClassID = getClassID(id: colorProfileClassKey)
|
let colorProfileClassID = getClassID(id: colorProfileClassKey)
|
||||||
let colorProfile = objectsArray[colorProfileClassID] as! NSDictionary
|
let colorProfile = objectsArray[colorProfileClassID] as! NSDictionary
|
||||||
|
|
||||||
|
@ -421,6 +422,9 @@ class Document: NSDocument {
|
||||||
if colorProfileName == "Display P3" {
|
if colorProfileName == "Display P3" {
|
||||||
info.colorSpace = CGColorSpace(name: CGColorSpace.displayP3)!
|
info.colorSpace = CGColorSpace(name: CGColorSpace.displayP3)!
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
info.colorSpace = CGColorSpace(name: CGColorSpace.displayP3)!
|
||||||
|
}
|
||||||
|
|
||||||
let backgroundClassKey = dict["backgroundColor"]
|
let backgroundClassKey = dict["backgroundColor"]
|
||||||
let backgroundClassID = getClassID(id: backgroundClassKey)
|
let backgroundClassID = getClassID(id: backgroundClassKey)
|
||||||
|
@ -448,12 +452,14 @@ class Document: NSDocument {
|
||||||
}
|
}
|
||||||
|
|
||||||
let authorClassKey = dict[AuthorNameKey]
|
let authorClassKey = dict[AuthorNameKey]
|
||||||
|
if authorClassKey != nil {
|
||||||
let authorClassID = getClassID(id: authorClassKey)
|
let authorClassID = getClassID(id: authorClassKey)
|
||||||
let authorString = objectsArray[authorClassID] as! String
|
let authorString = objectsArray[authorClassID] as! String
|
||||||
|
|
||||||
if authorString != "$null" {
|
if authorString != "$null" {
|
||||||
info.authorName = authorString
|
info.authorName = authorString
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let sizeClassKey = dict[SizeKey]
|
let sizeClassKey = dict[SizeKey]
|
||||||
let sizeClassID = getClassID(id: sizeClassKey)
|
let sizeClassID = getClassID(id: sizeClassKey)
|
||||||
|
|
Reference in a new issue