diff -up poppler-0.8.0/poppler-0.8.0/poppler/OptionalContent.cc.jx poppler-0.8.0/poppler-0.8.0/poppler/OptionalContent.cc --- poppler-0.8.0/poppler-0.8.0/poppler/OptionalContent.cc.jx 2008-03-14 20:24:54.000000000 -0400 +++ poppler-0.8.0/poppler-0.8.0/poppler/OptionalContent.cc 2008-04-06 18:56:06.000000000 -0400 @@ -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; }