1
Fork 0

Protect against some missing keys

This commit is contained in:
Joshua Goins 2022-05-09 20:46:59 -04:00
parent 78c36c9acf
commit 50d532aac9

View file

@ -410,15 +410,19 @@ class Document: NSDocument {
info.videoFrame = parsePairString(frameSize)!
let colorProfileClassKey = dict["colorProfile"]
let colorProfileClassID = getClassID(id: colorProfileClassKey)
let colorProfile = objectsArray[colorProfileClassID] as! NSDictionary
if colorProfileClassKey != nil {
let colorProfileClassID = getClassID(id: colorProfileClassKey)
let colorProfile = objectsArray[colorProfileClassID] as! NSDictionary
let colorProfileNameClassKey = colorProfile["SiColorProfileArchiveICCNameKey"]
let colorProfileNameClassID = getClassID(id: colorProfileNameClassKey)
let colorProfileName = objectsArray[colorProfileNameClassID] as! NSString
let colorProfileNameClassKey = colorProfile["SiColorProfileArchiveICCNameKey"]
let colorProfileNameClassID = getClassID(id: colorProfileNameClassKey)
let colorProfileName = objectsArray[colorProfileNameClassID] as! NSString
// we only support the basic "Display P3" color space... does Procreate actually store the ICC data??
if colorProfileName == "Display P3" {
// we only support the basic "Display P3" color space... does Procreate actually store the ICC data??
if colorProfileName == "Display P3" {
info.colorSpace = CGColorSpace(name: CGColorSpace.displayP3)!
}
} else {
info.colorSpace = CGColorSpace(name: CGColorSpace.displayP3)!
}
@ -448,11 +452,13 @@ class Document: NSDocument {
}
let authorClassKey = dict[AuthorNameKey]
let authorClassID = getClassID(id: authorClassKey)
let authorString = objectsArray[authorClassID] as! String
if authorClassKey != nil {
let authorClassID = getClassID(id: authorClassKey)
let authorString = objectsArray[authorClassID] as! String
if authorString != "$null" {
info.authorName = authorString
if authorString != "$null" {
info.authorName = authorString
}
}
let sizeClassKey = dict[SizeKey]