diff --git a/SilicaViewer/Document.swift b/SilicaViewer/Document.swift index 2dd374e..5a0a8c6 100644 --- a/SilicaViewer/Document.swift +++ b/SilicaViewer/Document.swift @@ -408,17 +408,21 @@ class Document: NSDocument { let frameSize = objectsArray[frameSizeClassID] as! String info.videoFrame = parsePairString(frameSize)! - + let colorProfileClassKey = dict["colorProfile"] - 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 - - // we only support the basic "Display P3" color space... does Procreate actually store the ICC data?? - if colorProfileName == "Display P3" { + 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 + + // 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 authorString != "$null" { - info.authorName = authorString + if authorClassKey != nil { + let authorClassID = getClassID(id: authorClassKey) + let authorString = objectsArray[authorClassID] as! String + + if authorString != "$null" { + info.authorName = authorString + } } let sizeClassKey = dict[SizeKey]