Commit e73c2ce9 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

Delete the optContent object if it's invalid

parent 2900e7e4
......@@ -202,6 +202,10 @@ Catalog::Catalog(XRef *xrefA) {
// get the Optional Content dictionary
if (catDict.dictLookup("OCProperties", &optContentProps)->isDict()) {
optContent = new OCGs(&optContentProps, xref);
if (!optContent->isOk ()) {
delete optContent;
optContent = NULL;
}
}
optContentProps.free();
......
......@@ -31,6 +31,7 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) :
m_orderArray(0), m_rBGroupsArray(), m_xref(xref)
{
// we need to parse the dictionary here, and build optionalContentGroups
ok = gTrue;
optionalContentGroups = new GooList();
Object ocgList;
......@@ -38,6 +39,7 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) :
if (!ocgList.isArray()) {
error(-1, "Expected the optional content group list, but wasn't able to find it, or it isn't an Array");
ocgList.free();
ok = gFalse;
return;
}
......@@ -66,6 +68,7 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) :
error(-1, "Expected the default config, but wasn't able to find it, or it isn't a Dictionary");
defaultOcgConfig.free();
ocgList.free();
ok = gFalse;
return;
}
#if 0
......
......@@ -32,6 +32,9 @@ public:
OCGs(Object *ocgObject, XRef *xref);
~OCGs();
// Is OCGS valid?
GBool isOk() { return ok; }
bool hasOCGs();
GooList *getOCGs() const { return optionalContentGroups; }
......@@ -43,6 +46,8 @@ public:
bool optContentIsVisible( Object *dictRef );
private:
GBool ok;
bool allOn( Array *ocgArray );
bool allOff( Array *ocgArray );
bool anyOn( Array *ocgArray );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment