Skip to content

Commit 9619f97

Browse files
added check for null oversight value
1 parent c30e9b3 commit 9619f97

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

clinicaltrials/clinicaltrials.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ function parse_dir(){
238238
function process_file($infile) {
239239
$indir = parent::getParameterValue('indir');
240240
$xml = new CXML($infile);
241+
241242
$this->setCheckPoint('file');
242243
while($xml->Parse("clinical_study") == TRUE) {
243244
$this->setCheckPoint('record');
@@ -364,16 +365,18 @@ function process_file($infile) {
364365
######################################################################################
365366
try {
366367
$oversight = @array_shift($root->xpath('//oversight_info'));
367-
$oversight_id = parent::getRes().md5($oversight->asXML());
368+
if($oversight !== null) {
369+
$oversight_id = parent::getRes().md5($oversight->asXML());
368370

369-
$authority = $this->getString('//authority', $oversight);
370-
$authority_id = parent::getRes().md5($authority);
371-
parent::addRDF(
372-
parent::describeIndividual($oversight_id,$authority,parent::getVoc()."Organization").
373-
parent::triplify($study_id,$this->getVoc()."oversight",$oversight_id).
374-
parent::triplify($study_id,$this->getVoc()."authority",$authority_id).
375-
parent::triplifyString($oversight_id, parent::getVoc()."has-dmc", $this->getString('//has_dmc', $oversight))
376-
);
371+
$authority = $this->getString('//authority', $oversight);
372+
$authority_id = parent::getRes().md5($authority);
373+
parent::addRDF(
374+
parent::describeIndividual($oversight_id,$authority,parent::getVoc()."Organization").
375+
parent::triplify($study_id,$this->getVoc()."oversight",$oversight_id).
376+
parent::triplify($study_id,$this->getVoc()."authority",$authority_id).
377+
parent::triplifyString($oversight_id, parent::getVoc()."has-dmc", $this->getString('//has_dmc', $oversight))
378+
);
379+
}
377380
} catch(Exception $e){
378381
echo "There was an error in the oversight info element: $e\n";
379382

0 commit comments

Comments
 (0)