2008-06-04 18:25:50 +00:00
|
|
|
diff -up poppler-0.8.3/poppler-0.8.3/poppler/OptionalContent.cc.jx poppler-0.8.3/poppler-0.8.3/poppler/OptionalContent.cc
|
|
|
|
--- poppler-0.8.3/poppler-0.8.3/poppler/OptionalContent.cc.jx 20.8.33-14 20:24:54.000000000 -0400
|
|
|
|
+++ poppler-0.8.3/poppler-0.8.3/poppler/OptionalContent.cc 20.8.34-06 18:56:06.000000000 -0400
|
2008-04-06 23:04:38 +00:00
|
|
|
@@ -162,6 +162,8 @@ OptionalContentGroup* OCGs::findOcgByRef
|
|
|
|
{
|
|
|
|
//TODO: make this more efficient
|
|
|
|
OptionalContentGroup *ocg = NULL;
|
|
|
|
+ if (!optionalContentGroups)
|
|
|
|
+ return NULL;
|
|
|
|
for (int i=0; i < optionalContentGroups->getLength(); ++i) {
|
|
|
|
ocg = (OptionalContentGroup*)optionalContentGroups->get(i);
|
|
|
|
if ( (ocg->ref().num == ref.num) && (ocg->ref().gen == ref.gen) ) {
|
|
|
|
@@ -208,7 +210,7 @@ bool OCGs::optContentIsVisible( Object *
|
|
|
|
}
|
|
|
|
} else if (ocg.isRef()) {
|
|
|
|
OptionalContentGroup* oc = findOcgByRef( ocg.getRef() );
|
|
|
|
- if ( oc->state() == OptionalContentGroup::Off ) {
|
|
|
|
+ if ( !oc || oc->state() == OptionalContentGroup::Off ) {
|
|
|
|
result = false;
|
|
|
|
} else {
|
|
|
|
result = true ;
|
|
|
|
@@ -218,11 +220,8 @@ bool OCGs::optContentIsVisible( Object *
|
|
|
|
policy.free();
|
|
|
|
} else if ( dictType.isName("OCG") ) {
|
|
|
|
OptionalContentGroup* oc = findOcgByRef( dictRef->getRef() );
|
|
|
|
- if ( oc ) {
|
|
|
|
-// printf("Found valid group object\n");
|
|
|
|
- if ( oc->state() == OptionalContentGroup::Off ) {
|
|
|
|
- result=false;
|
|
|
|
- }
|
|
|
|
+ if ( !oc || oc->state() == OptionalContentGroup::Off ) {
|
|
|
|
+ result=false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dictType.free();
|
|
|
|
@@ -253,6 +252,8 @@ bool OCGs::allOff( Array *ocgArray )
|
|
|
|
ocgArray->getNF(i, &ocgItem);
|
|
|
|
if (ocgItem.isRef()) {
|
|
|
|
OptionalContentGroup* oc = findOcgByRef( ocgItem.getRef() );
|
|
|
|
+ if (!oc)
|
|
|
|
+ continue;
|
|
|
|
if ( oc->state() == OptionalContentGroup::On ) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
@@ -268,6 +269,8 @@ bool OCGs::anyOn( Array *ocgArray )
|
|
|
|
ocgArray->getNF(i, &ocgItem);
|
|
|
|
if (ocgItem.isRef()) {
|
|
|
|
OptionalContentGroup* oc = findOcgByRef( ocgItem.getRef() );
|
|
|
|
+ if (!oc)
|
|
|
|
+ continue;
|
|
|
|
if ( oc->state() == OptionalContentGroup::On ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
@@ -283,6 +286,8 @@ bool OCGs::anyOff( Array *ocgArray )
|
|
|
|
ocgArray->getNF(i, &ocgItem);
|
|
|
|
if (ocgItem.isRef()) {
|
|
|
|
OptionalContentGroup* oc = findOcgByRef( ocgItem.getRef() );
|
|
|
|
+ if (!oc)
|
|
|
|
+ continue;
|
|
|
|
if ( oc->state() == OptionalContentGroup::Off ) {
|
|
|
|
return true;
|
|
|
|
}
|